Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-05 14:39:58


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk