diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2011-11-22 00:40:47 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2011-11-22 00:40:47 +0000 |
commit | e02a544331f909a699b1f18ff763efaab02eca3d (patch) | |
tree | ff0ebe47c171d37657b22137dfb8a390314ff92b /libstdc++-v3/include/tr1 | |
parent | 284953181c8c0d879569bbd6f0a25159026d39b2 (diff) | |
download | gcc-e02a544331f909a699b1f18ff763efaab02eca3d.zip gcc-e02a544331f909a699b1f18ff763efaab02eca3d.tar.gz gcc-e02a544331f909a699b1f18ff763efaab02eca3d.tar.bz2 |
functional (is_placeholder, [...]): Add partial specializations for cv-qualified types.
* include/std/functional (is_placeholder, is_bind_expression): Add
partial specializations for cv-qualified types.
* include/tr1/functional (is_placeholder, is_bind_expression): Add
partial specializations for std::bind and std::placeholders and for
cv-qualified types.
* testsuite/20_util/bind/cv_quals_3.cc: New.
* testsuite/tr1/3_function_objects/bind/cv_quals.cc: New.
* testsuite/tr1/3_function_objects/bind/mixed.cc: New.
From-SVN: r181607
Diffstat (limited to 'libstdc++-v3/include/tr1')
-rw-r--r-- | libstdc++-v3/include/tr1/functional | 176 |
1 files changed, 170 insertions, 6 deletions
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional index 7651326..ff2bd2a 100644 --- a/libstdc++-v3/include/tr1/functional +++ b/libstdc++-v3/include/tr1/functional @@ -43,9 +43,20 @@ #include <tr1/functional_hash.h> #include <ext/type_traits.h> #include <bits/move.h> // for std::__addressof +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +# include <type_traits> // for integral_constant, true_type, false_type +#endif namespace std _GLIBCXX_VISIBILITY(default) { +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + template<int> struct _Placeholder; + template<typename> class _Bind; + template<typename, typename> class _Bind_result; +_GLIBCXX_END_NAMESPACE_VERSION +#endif + namespace tr1 { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -847,16 +858,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION - /** @namespace std::placeholders - * @brief ISO C++ 0x entities sub namespace for functional. - * - * Define a large number of placeholders. There is no way to - * simplify this with variadic templates, because we're introducing - * unique names for each. + /** @namespace std::tr1::placeholders + * @brief Sub-namespace for tr1/functional. */ namespace placeholders { _GLIBCXX_BEGIN_NAMESPACE_VERSION + /* Define a large number of placeholders. There is no way to + * simplify this with variadic templates, because we're introducing + * unique names for each. + */ namespace { _Placeholder<1> _1; @@ -904,6 +915,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<int _Num> const int is_placeholder<_Placeholder<_Num> >::value; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<int _Num> + struct is_placeholder<std::_Placeholder<_Num>> + : std::integral_constant<int, _Num> + { }; + + template<int _Num> + struct is_placeholder<const std::_Placeholder<_Num>> + : std::integral_constant<int, _Num> + { }; +#endif + /** * Stores a tuple of indices. Used by bind() to extract the elements * in a tuple. @@ -1347,6 +1370,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Signature> const bool is_bind_expression<_Bind<_Signature> >::value; + /// Class template _Bind is always a bind expression. + template<typename _Signature> + struct is_bind_expression<const _Bind<_Signature> > + { static const bool value = true; }; + + template<typename _Signature> + const bool is_bind_expression<const _Bind<_Signature> >::value; + + /// Class template _Bind is always a bind expression. + template<typename _Signature> + struct is_bind_expression<volatile _Bind<_Signature> > + { static const bool value = true; }; + + template<typename _Signature> + const bool is_bind_expression<volatile _Bind<_Signature> >::value; + + /// Class template _Bind is always a bind expression. + template<typename _Signature> + struct is_bind_expression<const volatile _Bind<_Signature> > + { static const bool value = true; }; + + template<typename _Signature> + const bool is_bind_expression<const volatile _Bind<_Signature> >::value; + /// Class template _Bind_result is always a bind expression. template<typename _Result, typename _Signature> struct is_bind_expression<_Bind_result<_Result, _Signature> > @@ -1355,6 +1402,70 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Result, typename _Signature> const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value; + /// Class template _Bind_result is always a bind expression. + template<typename _Result, typename _Signature> + struct is_bind_expression<const _Bind_result<_Result, _Signature> > + { static const bool value = true; }; + + template<typename _Result, typename _Signature> + const bool + is_bind_expression<const _Bind_result<_Result, _Signature> >::value; + + /// Class template _Bind_result is always a bind expression. + template<typename _Result, typename _Signature> + struct is_bind_expression<volatile _Bind_result<_Result, _Signature> > + { static const bool value = true; }; + + template<typename _Result, typename _Signature> + const bool + is_bind_expression<volatile _Bind_result<_Result, _Signature> >::value; + + /// Class template _Bind_result is always a bind expression. + template<typename _Result, typename _Signature> + struct + is_bind_expression<const volatile _Bind_result<_Result, _Signature> > + { static const bool value = true; }; + + template<typename _Result, typename _Signature> + const bool + is_bind_expression<const volatile _Bind_result<_Result, + _Signature> >::value; + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Signature> + struct is_bind_expression<std::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<const std::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<volatile std::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<const volatile std::_Bind<_Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<std::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<const std::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<volatile std::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<const volatile std::_Bind_result<_Result, + _Signature>> + : true_type { }; +#endif + /// bind template<typename _Functor, typename... _ArgTypes> inline @@ -2147,6 +2258,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename> struct is_placeholder; + + template<int _Num> + struct is_placeholder<tr1::_Placeholder<_Num>> + : integral_constant<int, _Num> + { }; + + template<int _Num> + struct is_placeholder<const tr1::_Placeholder<_Num>> + : integral_constant<int, _Num> + { }; + + template<typename> struct is_bind_expression; + + template<typename _Signature> + struct is_bind_expression<tr1::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<const tr1::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<volatile tr1::_Bind<_Signature>> + : true_type { }; + + template<typename _Signature> + struct is_bind_expression<const volatile tr1::_Bind<_Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<tr1::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<const tr1::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<volatile tr1::_Bind_result<_Result, _Signature>> + : true_type { }; + + template<typename _Result, typename _Signature> + struct is_bind_expression<const volatile tr1::_Bind_result<_Result, + _Signature>> + : true_type { }; + +_GLIBCXX_END_NAMESPACE_VERSION +#endif } #endif // _GLIBCXX_TR1_FUNCTIONAL |