Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-29 11:06:22


Thanks!

On Thu, 29 Mar 2001, David Abrahams wrote:

abraha> I just intuit that it works something like this:
abraha>
abraha> struct default {};
abraha> struct base {
abraha> typedef default weight_type;
abraha> typedef default visitor_type;
abraha> };
abraha>
abraha> // make a similar visitor_t template
abraha> template <class T, class B = base>
abraha> struct weight_map_t : B {
abraha> typedef weight_map_t<T,B> self;
abraha>
abraha> template <class V>
abraha> visitor_t<V, self> visitor(const V& v)
abraha> {
abraha> return visitor_t<V,self>(v, *this)
abraha> }
abraha>
abraha> weight_map_t(const T& arg, B = base())
abraha> : m_value(arg) {}
abraha>
abraha> const T& m_value;
abraha> };
abraha>
abraha> template <class T>
abraha> weight_map_t<T> weight_map(const T& x) {
abraha> return weight_map_t<T>(x);
abraha> }
abraha>
abraha> I hope this quick sketch helps!
abraha>
abraha> -Dave
abraha> ----- Original Message -----
abraha> From: "Jeremy Siek" <jsiek_at_[hidden]>
abraha> To: <boost_at_[hidden]>
abraha> Sent: Thursday, March 29, 2001 12:30 AM
abraha> Subject: Re: [boost] Boost.Graph suggestions
abraha>
abraha>
abraha> >
abraha> > Are there any good articles written on how to do this named parameter
abraha> > thing for template functions? If not, would someone explain to me how it
abraha> > works?
abraha> >
abraha> > On Sun, 25 Mar 2001, David Abrahams wrote:
abraha> >
abraha> > abraha> I have 3. The one interesting one is the idea of using a named
abraha> parameters
abraha> > abraha> interface for some of the algorithms. For example, the only way to
abraha> pass a
abraha> > abraha> WeightMap to dijkstra_shortest_paths is to use the version of the
abraha> algorithm
abraha> > abraha> that takes all 7 possible parameters! If instead, the algorithm
abraha> could be
abraha> > abraha> invoked thus,
abraha> > abraha>
abraha> > abraha> dijkstra_shortest_paths(g, start,
abraha> > abraha> weight_map(my_weights).visitor(my_visitor))
abraha> > abraha>
abraha> > abraha> the interface would be far simpler.
abraha> > abraha>
abraha> > abraha> The other two are more mundane suggestions for the docs:
abraha> > abraha>
abraha> > abraha> 1. Put a link to the TOC prominently at the top of the
abraha> introduction page.
abraha> > abraha> It's a bit buried, and some people want to go directly to a user
abraha> manual to
abraha> > abraha> get a survey of features.
abraha> > abraha>
abraha> > abraha> 2. Begin using "Boost.Graph" or "boost::graph" instead of "BGL".
abraha> > abraha>
abraha> > abraha> -Dave
abraha> > abraha>
abraha> > abraha>
abraha> > abraha> To unsubscribe, send email to:
abraha> <mailto:boost-unsubscribe_at_[hidden]>
abraha> > abraha>
abraha> > abraha>
abraha> > abraha> Your use of Yahoo! Groups is subject to
abraha> http://docs.yahoo.com/info/terms/
abraha> > abraha>
abraha> > abraha>
abraha> > abraha>
abraha> >
abraha> > ----------------------------------------------------------------------
abraha> > Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
abraha> > Ph.D. Candidate email: jsiek_at_[hidden]
abraha> > Univ. of Notre Dame work phone: (219) 631-3906
abraha> > ----------------------------------------------------------------------
abraha> >
abraha> >
abraha> >
abraha> > To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
abraha> >
abraha> >
abraha> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
abraha> >
abraha> >
abraha>
abraha>
abraha> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
abraha>
abraha>
abraha> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
abraha>
abraha>
abraha>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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