
5 Mar
2007
5 Mar
'07
7:39 p.m.
Andrey Semashev <andysem <at> mail.ru> writes:
Just a thought... Maybe something like this might help:
typedef [implementation defined] uint_ptr_t;
template< typename > void foo() {}
template< typename T, uint_ptr_t TagV = (uint_ptr_t)&foo< T > > struct ordinal : public mpl::integral_c< uint_ptr_t, TagV > { };
struct system1 : ordinal< system1 > {}; struct system2 : ordinal< system2 > {};
The uint_ptr_t type should be large enough to accomodate a pointer to function. It is needed since function pointers cannot be ordered.
I suspect, not all compilers would allow this.
No compiler should allow it. (uint_ptr_t)&foo< T > is not a valid template argument. The address of foo<T> is not known until link time or later. In Christ, Steven Watanabe