Boost logo

Boost Users :

From: dmatt001 (dmatt001_at_[hidden])
Date: 2003-04-02 04:30:57


Furthermore, I now have another pre-emptive question (in addition to
those attached below) following on from my efforts ...:

I am trying to use a custom property. How do I write the equivalent of
(ie using a boost predefined map?):

boost::get(boost::vertex_name, v1)

such that I can access my custom property value_type? I am not sure
how to resolve for my graph_t as described below...?

Thanks again,

Matt

--- In Boost-Users_at_[hidden], "dmatt001" <dmatt001_at_y...> wrote:
> Hi Guys,
>
> I would like to use an ordered vertex list (ie based on property
type)
> in an implementation that I am working on such that duplication can
be
> avoided. I have read and understand how to implement an ordered edge
> list thanks to the previous posts but am finding it hard to get
started!
>
> Perhaps I have missed the key example? It appears that from the way
> config::VertList is constructed that it may be a similar process in
> nature? adj_list_impl::add_vertex appears to discard the boolean
> return value from the associative insertion. Would such a
construction
> allow me to avoid the duplication I seek to avoid? I am guessing so,
> but some advice would give me a confidence "boost". ( <-- It's a
lame
> pun: I really do need help ;-) )
>
> My first steps are below rehashing the excellent ordered edges
example
> with a simple search/replace and maching my target container base.
> I'll keep plugging along with it anyway and it may just compile one
> day. Suggestions/Ideas/Refs/Ptrs are appreciated.
>
> Matt
>
> --- first guess follows ---
>
> template <class VertDesc>
> struct order_by_name
> : public std::binary_function<VertDesc,VertDesc,bool>
> {
> bool operator()(const VertDesc& v1, const VertDesc& v2) const {
> // Order by vertex name.
> return boost::get(boost::vertex_name, v1)
> < boost::get(boost::vertex_name, v2);
> }
> };
>
> #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
>
> struct ordered_set_by_nameS { };
> namespace boost {
>
> template <class ValueType>
> struct container_gen<ordered_set_by_nameS, ValueType> {
> typedef std::set<ValueType, order_by_name<ValueType> > type;
>
> };
> }
> #else
>
> struct ordered_set_by_nameS {
>
> template <class T>
> struct bind_ { typedef std::multiset<T, order_by_name<T> > type;
};
>
> };
>
> namespace boost {
>
> template <> struct container_selector<ordered_set_by_nameS> {
> typedef ordered_set_by_nameS type;
>
> };
> }
> #endif


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