Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-07-11 02:52:53


Vladimir Prus <ghost <at> cs.msu.su> writes:

> 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

yeah, that would be magical :-) I not sure such a
syntax would be good.

> map<pair<int, int>,int> months;
> ( list_of(1, 2), 31 )
>
> does not work either.

something along these lines would be good. I think

insert( months )( map_list_of(1,2), 31 );

should work (because it is list_of<pair<T,U> >). Alternatively, you would need
to specify that you are using
pair<int,int> explicitly or use a typedef:

typedef pair<int,int> key_t;
insert( months )( key_t(1,2), 31 );

You have surely found something that could be better, ie, how can we deduce
what list_of should store?. I think it is impossible to do something like that.

br

Thorsten


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