Re: C++ as a target language
* SuperKoko:
"Alf P. Steinbach" wrote:
Yep. I think it's beyond hope to get a new, alternative typedef syntax
in place. In an ideal world, perhaps one could get a 'typename'
construct added, used like (compare to real code in previous posting)
<hypotheticalcode>
#include <utility> // std::pair
#include <boost/shared_ptr.hpp> // boost::shared_ptr
namespace stdx = boost;
template< typename T >
struct List
{
typename Node; // NEW LANGUAGE FEATURE, recursive defs.
typedef stdx::shared_ptr<Node> Instance;
typedef std::pair<T, Instance> Node;
static Instance null() { return Instance(); }
static Instance cons( T const& v, Instance list )
{
return Instance( new :Node( v, list ) );
}
};
Do you mean, something similar to (forward) declarations of structures.
Yes.
In that case, it is not possible
It is.
(or at least, not a good idea):
I think it is.
It would require that all pointers have the same object representation.
They already have, for pointers to class type objects. :-)
[lengthy irrelevant argument, snipped]
Cheers,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]