Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-08-04 12:39:17


AMDG

Robert Jones wrote:
> Am I correct in thinking that the purpose of this is is too present swap as
> a 'well-behaved'
> functor from a phoenix composition point of view, with a nested type member?
>

Yes.

> Also in this snippet, the function operator does 'using std::swap;' then
> uses 'swap' without
> quaification, rather than explicitly invoking std::swap. The effect of this
> (I assume) is
> to perform full name resolution on swap. Why is this done for swap, but not
> for any other
> std identifiers, eg copy?
>

In other cases, such as copy, we usually intend to call the standard
function.
By calling std::copy explicitly, we make sure that we are calling the
function
that we intend to.

Many types have an overloaded swap, which can be found by ADL.
Usually this swap is more efficient than the default implementation
in namespace std. We want to call this swap if it is present.

> Elsewhere in spirit\home\phoenix\stl\algorithm\detail\begin.hpp is this...
>
> namespace boost { namespace phoenix {
> namespace detail
> {
> template<class R>
> typename range_result_iterator<R>::type
> begin_(R& r)
> {
> return boost::begin(r);
> }
> }
> }}
>
> This seems to do nothing other than provide an 'indirection' to calling
> boost::begin. Is the purpose
> here to provide a possible opportunity for specialisation?
>

begin_ doesn't seem to be intended for specialization/overloading.
(It's in namespace detail and nothing in spirit specializes it)
I have no idea what it is for. It may just be a relict of
an earlier version.

In Christ,
Steven Watanabe


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