Boost logo

Boost :

Subject: Re: [boost] [context review] Performance questions
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-01-10 14:24:20


> > 4) Rvalue references sometimes miss forward(). For example
> > bost/context/context.hpp (line 60) must be like:
> >
> > template< typename Fn, typename Allocator>
> > static base_ptr_t make_context_(
> > Fn&& fn, std::size_t size, flag_unwind_t do_unwind,
> > flag_return_t do_return, Allocator const& alloc)
> > {
> > return base_ptr_t(
> > new detail::context_object< typename remove_reference< Fn
> >> ::type, Allocator>(
> > boost::forward(fn), alloc, size, do_unwind, do_return) );
> > }
> >
> > Also forward() calls are required on lines 76, 151, 156, 161 (instead
> > of static_cast< &&>)
> > Preprocessor generated constructors can also have their parameters forwarded.
> > Test cases can be add for this (create function object that is only
> > movable, and move it to the context instance)
> I was not aware of forward() - which boost lib contains it?

std::forward is in <utility>.

I didn't know there was a boost::forward - what is the purpose of it?

Regards,
Nate
                                               


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