summaryrefslogtreecommitdiff
path: root/boost/flyweight/flyweight.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-03-21 15:45:20 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-03-21 15:46:37 +0900
commit733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch)
treea5b214744b256f07e1dc2bd7273035a7808c659f /boost/flyweight/flyweight.hpp
parent08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff)
downloadboost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz
boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2
boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip
Imported Upstream version 1.58.0upstream/1.58.0
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/flyweight/flyweight.hpp')
-rw-r--r--boost/flyweight/flyweight.hpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/boost/flyweight/flyweight.hpp b/boost/flyweight/flyweight.hpp
index fcc867c852..1fb2009fcf 100644
--- a/boost/flyweight/flyweight.hpp
+++ b/boost/flyweight/flyweight.hpp
@@ -47,6 +47,7 @@
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400))
#pragma warning(push)
+#pragma warning(disable:4520) /* multiple default ctors */
#pragma warning(disable:4521) /* multiple copy ctors */
#endif
@@ -436,6 +437,54 @@ BOOST_TEMPLATED_STREAM(istream,ElemType,Traits)& operator>>(
} /* namespace boost */
+#if !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT)
+
+/* hash support */
+
+#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
+namespace std{
+
+template<typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)>
+struct hash<boost::flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)> >
+{
+ typedef std::size_t result_type;
+ typedef boost::flyweight<
+ T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)> argument_type;
+
+ result_type operator()(const argument_type& x)const
+ {
+ typedef typename argument_type::value_type value_type;
+
+ std::hash<const value_type*> h;
+ return h(&x.get());
+ }
+};
+
+} /* namespace std */
+#endif /* !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) */
+
+namespace boost{
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+namespace flyweights{
+#endif
+
+template<typename T,BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS(_)>
+std::size_t hash_value(const flyweight<T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)>& x)
+{
+ typedef typename flyweight<
+ T,BOOST_FLYWEIGHT_TEMPL_ARGS(_)
+ >::value_type value_type;
+
+ boost::hash<const value_type*> h;
+ return h(&x.get());
+}
+
+#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
+} /* namespace flyweights */
+#endif
+} /* namespace boost */
+#endif /* !defined(BOOST_FLYWEIGHT_DISABLE_HASH_SUPPORT) */
+
#undef BOOST_FLYWEIGHT_COMPLETE_COMP_OPS
#undef BOOST_FLYWEIGHT_TEMPL_ARGS
#undef BOOST_FLYWEIGHT_TYPENAME_TEMPL_ARGS