Boost logo

Boost :

From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2004-03-24 05:49:27


>
Joerg Walter <jhr.walter <at> t-online.de> writes:

[...]
> >
> > Is it only me, or did you forget to attach the code?
>
> Nope, we either have a mailing list or an OE problem. Uploaded to
> http://groups.yahoo.com/group/boost/files/tcs.cpp

Thanks

>
> > > I miserably failed to define a composite unique key for my indexed_set.
[...]
>
> I already had. Trying to define
>
> typedef is::indexed_set<
> study,
> is::index_list<
> is::non_unique<is::tag<student_tag>,
> is::identity<study>, advisor_comparer>,
> is::non_unique<is::tag<advisor_tag>,
> is::identity<study>, date_comparer>
> is::unique<is::tag<pk_tag>, compose_key<
> BOOST_INDEXED_SET_MEMBER(study, string, name),
> BOOST_INDEXED_SET_MEMBER(study, string, advisor)
> >
> >,
> >
> > tcs_genealogy;
>
> failed to compile in compose_key's
>
> template<typename Arg>
> result_type operator()(Arg& arg)const;
>

Now I think I know what you're after. compose_key composes
two keys the way mathematical composition of functions
work, i.e.

  comp_key(arg) := key1(key2(arg))

and this is not what you want to do (if I understood you
right.) Instead, you may use lex_compare (as you are already
doing in your TCS port.)

[...]
>
> If namespace boost is not OK, then namespace boost::container probably would
> be a better choice.
>

But I think auxiliary components (index_list, unique, tag, etc.)
should have a namespace of their own. They're too specific to
inhabit boost::container, IMHO.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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