Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-19 15:17:20


From: David Abrahams <dave_at_[hidden]>
> Rob Stewart <stewart_at_[hidden]> writes:
> > I just took a look at> http://boost-consulting.com/boost/libs/parameter/doc/html/index.html> and I have a few comments.
> Rob,
> Thanks for your edits. Most were excellent and I integrated themimmediately.

I'm glad to help.

> Seeing the function described via table is harder to grasp.
> I suggest showing the function signature first, but omit the
> defaults for clarity. That will provide parameter names, in
> context, which will make the connection to the table simpler.
>
> I'm not sure what to do about that one. The "function
> signature" is afully general function template, with an
> overload to handle mutablelvalues for the color_map. If you
> can suggest something that works,I'm open to it.

I just looked at
http://www.boost.org/libs/graph/doc/depth_first_search.html and
didn't see a function like the one you're using. However, I can
guess at what it ought to look like from your table:

   template <
        class Graph
      , class DFSVisitor
      , class Root
      , class ColorMap
>
   void depth_first_search(Graph const & graph, DFSVisitor visitor,
      Root root_vertex, IndexMap index_map, ColorMap & color);

Whether any of the other types should use references to const I
can't say. Since color was described as an OUT parameter, I
assumed that meant reference to non-const.

> I don't know what to do about the hard-to-see vertical ellipsis.Maybe just use
> . . .
> instead?

You could use &#183; (a.k.a. &middot;), but the real issue is to
trigger a much larger font size.

> You asked:
> *Where is this assignment occurring?*
> I tried to clarify:
> On the other hand, when passing arguments by keyword, the
> keyword object's assignment operator yields a temporary
> |ArgumentPack| object, and a conforming C++ compiler will
> refuse to bind a non-``const`` reference to a temporary.

That does it.

> You rewrote this section, and then also seemed confused about
> what itmeans:
> a conforming C++ compiler will refuse to bind a non-``const``
> reference to a temporary. To support an interface in which the
> last argument is passed by keyword, there must be a
> ``depth_first_search`` overload taking its argument by
> ``const`` reference.
>
> Here's your rewrite:
> a conforming C++ compiler will refuse to bind a non-``const``
> reference to a temporary. To support an interface in which the
> last parameter is an “out” parameter, and the
> last argument is passed by keyword, there must be a
> ``depth_first_search`` overload taking its other arguments by
> ``const`` reference.
>
> But your rewrite changes the meaning substantially. Maybe you
> couldtry to understand what I wrote or ask some more questions
> before wetry to make it better?

Well, I thought I understood what you were trying to say,
obviously, or I wouldn't have attempted the rewrite. So, let's
see what your version is saying (to me).

You say that there must be an "overloading taking its
argument...." Note the singular. depth_first_search() takes
multiple arguments, so there's an incongruity or I don't
understand the overload to which you refer. To make the
confusion complete, the code snippet immediately following shows
this:

   template <class A0, class A1, \x{2026}class A4>
   void depth_first_search(A0 const& a0, A1 const& a1, \x{2026}A4& a4)
   {
       core::depth_first_search(dfs_params()(a0,a1,a2,a3,a4));
   }

I see multiple arguments.

It is notable that you've highlighted "const&" and "&" where they
appear. That suggests that all of the arguments other than the
last should be references to const. So, that leads to "there
must be [an] overload taking its other arguments by const
reference."

What did I miss?

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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