Fixed regression

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@665 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-05-21 09:21:52 +00:00
parent 24530c4e3c
commit c697b48802
7 changed files with 76 additions and 24 deletions

View file

@ -12,9 +12,7 @@
#include "../config.hpp"
#include "lambda.hpp"
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/make_shared.hpp>
#include <boost/function.hpp>
#include <boost/ref.hpp>
@ -37,26 +35,19 @@ namespace detail
public:
template< typename Value >
void returns( Value v,
BOOST_DEDUCED_TYPENAME boost::enable_if<
boost::is_convertible< Value, result_type > >::type* = 0 )
void returns( Value v )
{
r_ = boost::make_shared< Value >( v );
f_ = lambda_type::make_val( boost::ref( *r_ ) );
}
template< typename Value >
void returns( Value* v )
{
r_ = boost::make_shared< result_type >( v );
f_ = lambda_type::make_val( boost::ref( *r_ ) );
}
template< typename Value >
void returns( Value v,
BOOST_DEDUCED_TYPENAME boost::disable_if<
boost::is_convertible< Value, result_type > >::type* = 0 )
{
// if an error is generated by the line below it means a value
// passed to 'returns' was of the wrong type as it cannot be
// used to copy construct a Result
r_ = boost::make_shared< Value >( v );
f_ = lambda_type::make_val( boost::ref( *r_ ) );
}
template< typename Y >
void returns( boost::reference_wrapper< Y > r )
void returns( const boost::reference_wrapper< Y >& r )
{
f_ = lambda_type::make_val( r );
}
@ -98,7 +89,7 @@ namespace detail
f_ = lambda_type::make_val( r );
}
template< typename Y >
void returns( boost::reference_wrapper< Y > r )
void returns( const boost::reference_wrapper< Y >& r )
{
f_ = lambda_type::make_val( r );
}
@ -211,7 +202,7 @@ namespace detail
f_ = lambda_type::make_val( boost::ref( r_ ) );
}
template< typename Y >
void set( boost::reference_wrapper< Y > r )
void set( const boost::reference_wrapper< Y >& r )
{
f_ = lambda_type::make_val( r );
r_.reset();