summaryrefslogtreecommitdiff
path: root/boost/proto/detail/poly_function.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/proto/detail/poly_function.hpp')
-rw-r--r--boost/proto/detail/poly_function.hpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/boost/proto/detail/poly_function.hpp b/boost/proto/detail/poly_function.hpp
index 55a4dbf3c3..2bde53bda9 100644
--- a/boost/proto/detail/poly_function.hpp
+++ b/boost/proto/detail/poly_function.hpp
@@ -24,6 +24,7 @@
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/detail/is_noncopyable.hpp>
#ifdef _MSC_VER
# pragma warning(push)
@@ -37,21 +38,28 @@ namespace boost { namespace proto { namespace detail
template<typename T>
struct normalize_arg
{
- typedef T type;
+ typedef typename mpl::if_c<is_noncopyable<T>::value, T &, T>::type type;
+ typedef T &reference;
+ };
+
+ template<typename T>
+ struct normalize_arg<T const>
+ {
+ typedef typename mpl::if_c<is_noncopyable<T>::value, T const &, T>::type type;
typedef T const &reference;
};
template<typename T>
struct normalize_arg<T &>
{
- typedef T type;
- typedef T const &reference;
+ typedef typename mpl::if_c<is_noncopyable<T>::value, T &, T>::type type;
+ typedef T &reference;
};
template<typename T>
struct normalize_arg<T const &>
{
- typedef T type;
+ typedef typename mpl::if_c<is_noncopyable<T>::value, T const &, T>::type type;
typedef T const &reference;
};
@@ -63,6 +71,13 @@ namespace boost { namespace proto { namespace detail
};
template<typename T>
+ struct normalize_arg<boost::reference_wrapper<T> const>
+ {
+ typedef T &type;
+ typedef T &reference;
+ };
+
+ template<typename T>
struct normalize_arg<boost::reference_wrapper<T> &>
{
typedef T &type;
@@ -93,7 +108,7 @@ namespace boost { namespace proto { namespace detail
type operator()() const
{
- return *this;
+ return this->value;
}
private:
@@ -117,7 +132,7 @@ namespace boost { namespace proto { namespace detail
type operator()() const
{
- return *this;
+ return this->value;
}
private:
@@ -137,8 +152,8 @@ namespace boost { namespace proto { namespace detail
{};
////////////////////////////////////////////////////////////////////////////////////////////////
- #define BOOST_PROTO_POLY_FUNCTION() \
- typedef void is_poly_function_base_; \
+ #define BOOST_PROTO_POLY_FUNCTION() \
+ typedef void is_poly_function_base_; \
/**/
////////////////////////////////////////////////////////////////////////////////////////////////