Boost logo

Boost Users :

From: Marshall Clow (marshall_at_[hidden])
Date: 2005-01-31 14:41:40


I'm trying to use boost::multi_index for the first time, and I'm
getting odd compile errors.
I have a class with two "keys", a text one and a numeric one, and I
want to have two indices
into the collection.

So, I tried several things, and all of them get the same error:
'index_class' is not a member of class
'boost::multi_index::ordered_unique<boost::multi_index::identity<Foo>,
boost::multi_index::detail::null_arg,
boost::multi_index::detail::null_arg>'
        (and then an amazing cascade after that)

Here's the basic idea:

typedef boost::multi_index_container <
        Foo,
        boost::multi_index::indexed_by <

        boost::multi_index::ordered_unique <
boost::multi_index::identity < Foo >, LessThanNumeric >,
        boost::multi_index::ordered_unique <
boost::multi_index::identity < Foo >, LessThanText >
>
> Foo_;

where LessThanNumeric (and LessThanText, too) looks like this:

        struct LessThanNumeric: std::binary_function< Foo, Foo, bool > {
                bool operator () ( const Foo& x, const Foo& y ) const {
                        return x.NumericKey () < y.NumericKey ();
                        }
                };

My source is at <http://www.idio.com/misc/mi-test.cpp>

Anyone got any tips?
Thanks!

-- 
-- Marshall
Marshall Clow     Idio Software   <mailto:marshall_at_[hidden]>
It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.

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