Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2004-12-01 12:03:59


David Abrahams wrote:
> But I don't really understand what you're talking about. Too much
> missing detail :(

You're right, of course. I was under impression yesterday and posted it
without any explanation.
The cleanest way to explain it is an analogy with mpl unique algorithm.
Let say we have mpl::vector700 of free unary function signatures with only few
of them being unique. The algorithm I've tested is similar to this:

typedef mpl::vector700< /* 700 signatures of free unary functions */ > signatures;
typedef mpl::unique<signatures, is_same<_1,_2> >::type unique_signatures;

My algorithm takes positions as mpl::range_c<int,1,701> and a class with
700 call-operators. It returns a positions of unique signatures:

struct X
{
    void operator()(overloads::overload_id<1>, int) const {}
    void operator()(overloads::overload_id<2>, char) const {}
    // ...
    void operator()(overloads::overload_id<10>, int***) const {}
    // ...
    void operator()(overloads::overload_id<200>, int*) const {}
    // ...
    void operator()(overloads::overload_id<700>, int*) const {}
};

int main()
{
    typedef unique<X, mpl::range_c<int,1,701>, mpl::identity<_1>, uniform_row_search>::type result;
    BOOST_MPL_ASSERT(( mpl::equal<result, mpl::vector_c<int,1,2,10,39,200> > ));
}

-- 
Alexander Nasonov

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