|
Boost : |
From: Jan Langer (jan_at_[hidden])
Date: 2003-02-03 02:23:48
Vladimir Prus wrote:
> >>ghost> I think the best approach would be to make this concept
> explicit, and
> >>ghost> independent from BGL. Something like
> >>ghost>
> >>ghost> type_indexed_container<
> >>ghost> mpl::list<
> >>ghost> pair<vertex_name_t, int >,
> >>ghost> pair<vertex_distance_t, int> > > c;
> >>ghost> c[vertex_name_t()] = 10;
> >>ghost> I wonder if something like this already exists... I
> vaguely recall
> >>ghost> someone was doing that.
> >>
> >>Yes, Emily Winch was working on this, and I thought she was going to
> >>submit to boost. The following URL has a paper she wrote about this.
> >>
> >>http://www.oonumerics.org/tmpw01/schedule.html
> >
> Personally, I did not really notice your announcements. Some time ago
> I wanted a dynamic type-indexed container, in which you specify the
> required type, and it's either returned, or created. After quite look
> on some email of yours I decided it's something different and stopped
> reading.
i needed that (or maybe something similar) for the filesystem attributes
in the sandbox. i tried to make it compatible to the property map
concept. the output can be used as follows (taken from
boost-sandbox/libs/filesystem/test/type_pm_test.cpp)
boost::filesystem::detail::
type_property_map <char> pm;
put <int> (pm, 'i');
put <char> (pm, 'c');
BOOST_TEST (get <char> (pm) == 'c');
BOOST_TEST (get <int> (pm) == 'i');
BOOST_TEST (get <long> (pm) == long ());
it is implemented using Lokis TypeInfo and a std::map <TypeInfo, T>
where T is the type to store. it is possible to add another layer which
sets T to boost::any and converts everything in overloaded get/put
functions. the current attribute cache is (nearly) an example for that.
boost::fs::cache c (path);
std::cout << get <size> (c);
jan
-- jan langer ... jan_at_[hidden] "pi ist genau drei"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk