summaryrefslogtreecommitdiff
path: root/boost/flyweight/detail/default_value_policy.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/flyweight/detail/default_value_policy.hpp')
-rw-r--r--boost/flyweight/detail/default_value_policy.hpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/boost/flyweight/detail/default_value_policy.hpp b/boost/flyweight/detail/default_value_policy.hpp
index 186e1e0d8b..4209a69c1c 100644
--- a/boost/flyweight/detail/default_value_policy.hpp
+++ b/boost/flyweight/detail/default_value_policy.hpp
@@ -1,4 +1,4 @@
-/* Copyright 2006-2008 Joaquin M Lopez Munoz.
+/* Copyright 2006-2014 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -9,12 +9,14 @@
#ifndef BOOST_FLYWEIGHT_DETAIL_DEFAULT_VALUE_POLICY_HPP
#define BOOST_FLYWEIGHT_DETAIL_DEFAULT_VALUE_POLICY_HPP
-#if defined(_MSC_VER)&&(_MSC_VER>=1200)
+#if defined(_MSC_VER)
#pragma once
#endif
+#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
+#include <boost/detail/workaround.hpp>
+#include <boost/flyweight/detail/perfect_fwd.hpp>
#include <boost/flyweight/detail/value_tag.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
/* Default value policy: the key is the same as the value.
*/
@@ -35,10 +37,31 @@ struct default_value_policy:value_marker
{
/* template ctors */
-#define BOOST_FLYWEIGHT_PERFECT_FWD_NAME explicit rep_type
-#define BOOST_FLYWEIGHT_PERFECT_FWD_BODY(n) \
- :x(BOOST_PP_ENUM_PARAMS(n,t)){}
-#include <boost/flyweight/detail/perfect_fwd.hpp>
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)&&\
+ !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)&&\
+ BOOST_WORKAROUND(__GNUC__,<=4)&&(__GNUC__<4||__GNUC_MINOR__<=4)
+
+/* GCC 4.4.2 (and probably prior) bug: the default ctor generated by the
+ * variadic temmplate ctor below fails to value-initialize x.
+ */
+
+ rep_type():x(){}
+#endif
+
+#define BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY(args) \
+ :x(BOOST_FLYWEIGHT_FORWARD(args)){}
+
+ BOOST_FLYWEIGHT_PERFECT_FWD(
+ explicit rep_type,
+ BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY)
+
+#undef BOOST_FLYWEIGHT_PERFECT_FWD_CTR_BODY
+
+ rep_type(const rep_type& r):x(r.x){}
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ rep_type(rep_type&& r):x(std::move(r.x)){}
+#endif
operator const value_type&()const{return x;}
@@ -47,6 +70,10 @@ struct default_value_policy:value_marker
static void construct_value(const rep_type&){}
static void copy_value(const rep_type&){}
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ static void move_value(const rep_type&){}
+#endif
};
} /* namespace flyweights::detail */