Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-06-04 09:09:04


I'm not sure why I never saw this on the list, but since I saw the
moderation request and I figure you deserve a reply...

boost-owner_at_[hidden] writes:

> From: "Sascha" <vudu_at_[hidden]>
> Subject: boost::transform_iterator( Iterator const& x ) ???
> To: <boost_at_[hidden]>
> Date: Thu, 3 Jun 2004 00:22:18 +0200
>
> hi
>
> a simple question about the construction of
> boost::transform_iterator.
>
> currently there are two ctors implemented:
>
> transform_iterator();
> transform_iterator(Iterator const& x, UnaryFunction f);
>
> why does boost::transform_iterator(Iterator const& x) not exist leaving
> the function object default constructed?

Are you looking at the source code or the documentation? Oh, I see
you're doing as you should and looking at the documentation!

Well it turns out that the source code actually contains this
constructor:

    explicit transform_iterator(Iterator const& x)
      : super_t(x)
    {
        // don't provide this constructor if UnaryFunction is a
        // function pointer type, since it will be 0. Too dangerous.
        BOOST_STATIC_ASSERT(is_class<UnaryFunction>::value);
    }

> can I add it without getting in trouble?

No, but we can fix the documentation ;-)

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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