Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-06-06 15:27:17


std::map has a constructor which accepts iterator to the begin and the end
of the range being inserted at construction time. You can use them to insert
items at construction time.

Good Luck,
Ovanes

On Fri, Jun 6, 2008 at 8:35 PM, Sean Farrow <sean.farrow_at_[hidden]>
wrote:

> Hi:
> Thanks for that, Can I fill a map up at construction withou using
> std::Map::Insert? Can I do this with Boost::MultiIndex?
> Sean.
>
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:
> boost-users-bounces_at_[hidden]] On Behalf Of JOAQUIN M. LOPEZ MUÑOZ
> Sent: 06 June 2008 18:56
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Boost::MultiIndex or std::map
>
> Hi Sean,
> ________________________________________
> De: boost-users-bounces_at_[hidden] [
> boost-users-bounces_at_[hidden]] En nombre de Sean Farrow [
> sean.farrow_at_[hidden]] Enviado el: viernes, 06 de junio de 2008
> 19:26
> Para: boost-users_at_[hidden]
> Asunto: [Boost-users] Boost::MultiIndex or std::map
>
> > Hi:
> > I am in a situation where by I need to be able to query an associative
> > container. I need to fill the container before querying. The key is an
> > integer and the vlaue is a std::string. Can I construct
> > boost::multiIndex so as to allow key/value pairs to be entered at
> > construction time or should I just use std::map and write a function.
>
> I'm not sure I'm getting your question, but certainly you can fill up a
> std::map with key/value pairs before querying it!
>
> std::map<int,std::string> m;
> m.insert(std::make_pair(0,"zero"));
> m.insert(std::make_pair(1,"one"));
> ...
> m.find(1);
>
> What's it that you contend you can't do with a std::map but you can with a
> multi_index_container?
>
> Joaquín M López Muñoz
> Telefónica, Investigación y Desarrollo
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 3164 (20080606) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 3164 (20080606) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net