Boost logo

Boost :

Subject: Re: [boost] std::map<> - like structure for other than std::pair<>?
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2015-04-15 10:51:18


Dominique Devienne <ddevienne <at> gmail.com> writes:

>
> On Wed, Apr 15, 2015 at 1:23 PM, David Hagood <david.hagood <at>
> gmail.com>
> wrote:
>
> > One problem I see with using a set is that the whole data type is
> > used as the key [...]

Adding to Dominique's answer, here's an example of how the thing could be
done with Boost.MultiIndex:

    #include <boost/multi_index_container.hpp>
    #include <boost/multi_index/ordered_index.hpp>
    #include <boost/multi_index/member.hpp>
    #include <iostream>
    #include <string>
    #include <vector>
    
    using namespace boost::multi_index;
    
    struct Property
    {
      std::string name;
      int payload;
    };
    
    typedef multi_index_container<
      Property,
      indexed_b(€€€€€€€½É‘•É•‘}Õ¹¥ÅÕ”ñµ•µ‰•ÈñAɽÁ•ÉÑä±ÍѐèéÍÑÉ¥¹œ°™AɽÁ•ÉÑäèé¹…µ”øø(€€€€€€ø(€€€€øÍ•Ñ}Ðì(€€€€(€€€¥¹Ðµ…¥¸ ¤(€€€ì(€€€€€ÍѐèéÙ•Ñ½ÈñAɽÁ•ÉÑäøµ•Ñ„ô(€€€€€€€í쉡•±±¼ˆ°Áô±ì‰‰å”ˆ°Åô±ì‰Ý½É±ˆ°Íô±ì‰‰½½ÍЈ°Ñõôì(€€€€€Í•Ñ}Ѐ€€€€€€€€€€€€€€€Ííµ•Ñ„¹‰•¥¸ ¤±µ•Ñ„¹•¹ ¥ôì(€€€€€€(€€€€€Íѐè鍽ÕÐðñ̹™¥¹ ‰‰½½ÍЈ¤´ùÁ…å±½…ðð‰q¸ˆì€¼¼ÁÉ¥¹ÑÌ€Ð(€€€€€€€¼¼¡…¹”Á…å±½…½˜€‰¡•±±¼ˆÑ¼€Ô(€€€€€…ÕѼ¥Ðõ̹™¥¹ ‰¡•±±¼ˆ¤ì(€€€€€Ì¹µ½‘¥™ä¡¥Ð±mt¡AɽÁ•ÉÑ䘁à¥íà¹Á…å±½…ôÔíô¤ì(€€€€€Íѐè鍽ÕÐðñ¥Ð´ùÁ…å±½…ðð‰q¸ˆì€¼¼ÁÉ¥¹ÑÌ€Ô(€€€ô())½…Å×µ¸43ÍÁ•è5׎è)Q•±•›͹¥„


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