Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-10 02:59:22


Thorsten Ottosen wrote:

> Vladimir Prus <ghost <at> cs.msu.su> writes:
>
>>> Ok, I understand. I'm writing at the moment code like:
>> .......
>> (*casts)[make_pair(Type::FloatTy, Type::DoubleTy)] =
>> NM::FTOD;
>>
>> and I think I'd rather like to eliminate that (*casts) part, and
>> make_pair, but while assign library can eliminate (*casts), I'm not sure
>> it can do much about 'make_pair'. Or it can....?
>
> Hm...it can't totally figure out you code, but surely you don't need
> make-pair or anything. Any list of arguments can be forwarded to a call to
> the constructor of the type you're dealing with.
>
> Please see the docs in /libs/assign/

Hmm.. maybe you can give me more hints? While:

    vector<pair<int, int> > v;
    push_back(v)(1, 2);

works,

    map<pair<int, int>,int> months;
    insert(months)
        (1, 2, 3);

does not, and

    map<pair<int, int>,int> months;
        ( list_of(1, 2), 31 )

does not work either.

- Volodya


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