Boost logo

Boost :

From: Langston, Matthew D. (langston_at_[hidden])
Date: 2000-09-05 14:12:39


I believe my suggestions should be directed to John Maddock, as he is listed
as the maintainer of the call_traits documentation at
http://www.boost.org/libs/utility/call_traits.htm. However, both John and
the list may want to set me straight in case my suggestions are bogus.

In "Example 3 (the make_pair problem):", the std::make_pair function
template is rewritten to use call_traits. However, the example currently
shows the arguments to the make_pair function template as being passed in as
const references as follows:

  template <class T1, class T2>
  std::pair<typename boost::call_traits<T1>::value_type,
            typename boost::call_traits<T2>::value_type>
  make_pair(const T1& t1, const T2& t2);

Shouldn't they be passed in using boost::call_traits<T>::param_type instead,
i.e. with the following signature:

  template <class T1, class T2>
  std::pair<typename boost::call_traits<T1>::value_type,
            typename boost::call_traits<T2>::value_type>
  make_pair(boost::call_traits<T1>::param_type t1,
            boost::call_traits<T2>::param_type t2);

In "Example 4 (optimizing fill)", the std::fill function template is
rewritten to use call_traits. However, the example currently shows the last
argument to the fill function template as being passed in as a const
reference as follows:

template <class I, class T>
inline void fill(I first, I last, const T& val);

Shouldn't it be passed in using boost::call_traits<T>::param_type instead,
i.e. with the following signature:

template <class I, class T>
inline void fill(I first, I last, boost::call_traits<T>::param_type val);

The reason I make these two suggestions is that IMHO the call_traits
examples should be consistent in their usage of call_traits. However,
perhaps there is a reason why the examples were written the way that they
are that I don't fully appreciate.

Regards, Matt

--
Matthew D. Langston
SLD, Stanford Linear Accelerator Center
langston_at_[hidden]

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