|
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¸ì¼¼ÁÉ¥¹ÑÌÔ(ô())½
Å×µ¸43ÍÁè5׎è)Q±Í¹¥
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk