Boost logo

Boost Users :

From: Evan Carew (carew_at_[hidden])
Date: 2005-12-30 16:02:32


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The following is todays log of my efforts to get multi_index to work:

- ---First entry:
I'm using boost multi index for the first time. I've managed to populate
the container with my data & now I am trying to get the non-unique
ordered index to work. Does anyone have a source example (not from the
boost.multiindex tutorial please) used to get a list, set, whatever, of
tuples from such a search on such an index?

Thanks,
Evan Carew

P.S.
G++ V3.4.2
Boost version 103300

- ---Second entry:
Hmm... Looks like their list server is down. I am unable to register. <sigh>

- ---Third entry:
Well, lets try this example source code:

typedef multi_index::multi_index_container<
    person,
    multi_index::indexed_by<
      multi_index::ordered_unique<
        multi_index::tag<voterid>,
BOOST_MULTI_INDEX_MEMBER(person,unsigned long,voterid)>,
      multi_index::ordered_non_unique<

multi_index::tag<lastname>,BOOST_MULTI_INDEX_MEMBER(person,string,lastname)>,
      multi_index::ordered_non_unique<
        multi_index::tag<resstreetnum>,
BOOST_MULTI_INDEX_MEMBER(person,int,resstreetnum)> >
> people_set;

.....

int main(){
    const people_set::nth_index<2>::type& resstreet_index=ps.get<2>();
    pair<people_set::iterator, people_set::iterator> range;
    range = resstreet_index.equal_range((*domoItor).first);
}

The above code doesn't compile.

- ---Fourth entry:
By changing the pair instance to:

    pair<people_set::nth_index<2>::type::iterator,
people_set::nth_index<2>::type::iterator> range;

I finally got it to compile. I managed this not by reading the tutorial
for the library (the information isn't there) but from reading the
rather prodigious code in multi_index.

- ---Fifth entry:
Am I headed in the right direction, or is there specific interface that
defines the iterator types in a less painful/safe way?

Evan Carew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDtaBppxCQXwV2bJARAtYyAJ4lZRAoEbT1m0jsllTGAfmUZEpqSwCguhZO
V18uawK1QSD2iJF00hPm4qA=
=qn+Q
-----END PGP SIGNATURE-----


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