Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2007-03-01 14:25:58


> But wait, there is hope: you can do this:
>
> ////////
>
> template<class A>
> struct ordinal {
> void * tag() {
> static int const tag_;
> return &tag_;
> }
> template<class B>
> bool operator<(ordinal<B> const& other) {
> return std::less<void*>(tag(), other.tag());
> }
> };
>
> //////
>
> This solution should also be MT safe.

Unfortunately, this doesn't function at compile-time.
That is, what I really want to be able to do is:

struct system1 : ordinal<...> { };
struct system2 : ordinal<...> { };
struct system3 : ordinal<...> { };

typedef mpl::list<system2,system3,system1> list_type;
typedef mpl::sort<list_type>::type sorted_list_type;

where mpl::less<> can be defined for ordinal<...>

It seems like a hard (maybe impossible) problem...

Matthias

----------------------------------------------------------------
Matthias Schabel
2859 Glen Oaks Drive
Salt Lake City, UT 84109
801-706-5760 (cell)
801-484-0811 (home)
matthias at stanfordalumni dot org
----------------------------------------------------------------




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