[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost
Subject:    Re: [boost] Associative container using a vector
From:       Stefan Strasser <strasser () uni-bremen ! de>
Date:       2013-03-31 17:48:38
Message-ID: 515876F6.5080500 () uni-bremen ! de
[Download RAW message or body]

 >> struct A{
 >>      vector<Value> values;
 >>      vector<std::size_t> freelist;
 >>      map<Value,std::size_t> index;
 >>
 >>      void erase(...){ push index of unused value to freelist; }
 >>      void push_back(Value){ reuse a freelist entry or 
values.push_back; }
 >> };
 >> struct B{
 >>      vector<optional<Data> > data;
 >> };
Am 31.03.2013 19:22, schrieb Michael Marcin:
>> template<class Value>
>> class index;
>>
>> template<class Mapped,class OptionalTraits=boost_optional_traits>
>> class vector_map;
>>
>> Is there anything like that?
>>
>
> Is this multi-index?
>

I don't think so. At least I can't find it.
You could implement my "struct A" above using Boost.MultiIndex as it 
uses a vector and a map, but I can't find a map implementation that uses 
a vector with empty values for almost-contiguous keys.
keep in mind the one-to-many relationship between A and B. I'd like to 
be able to do ONE map lookup to receive a key with which you can access 
many associated data values in B objects.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic