]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | //----------------------------------------------------------------------------- |
2 | // boost variant/detail/has_result_type.hpp header file | |
3 | // See http://www.boost.org for updates, documentation, and revision history. | |
4 | //----------------------------------------------------------------------------- | |
5 | // | |
6 | // Copyright (c) 2014-2015 Antony Polukhin | |
7 | // | |
8 | // Distributed under the Boost Software License, Version 1.0. (See | |
9 | // accompanying file LICENSE_1_0.txt or copy at | |
10 | // http://www.boost.org/LICENSE_1_0.txt) | |
11 | ||
12 | #ifndef BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP | |
13 | #define BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP | |
14 | ||
15 | #include <boost/config.hpp> | |
16 | #include <boost/type_traits/remove_reference.hpp> | |
17 | ||
18 | ||
19 | namespace boost { namespace detail { namespace variant { | |
20 | ||
21 | template <typename T > | |
22 | struct has_result_type { | |
23 | private: | |
24 | typedef char yes; | |
25 | typedef struct { char array[2]; } no; | |
26 | ||
27 | template<typename C> static yes test(typename boost::remove_reference<typename C::result_type>::type*); | |
28 | template<typename C> static no test(...); | |
29 | ||
30 | public: | |
31 | BOOST_STATIC_CONSTANT(bool, value = sizeof(test<T>(0)) == sizeof(yes)); | |
32 | }; | |
33 | ||
34 | }}} // namespace boost::detail::variant | |
35 | ||
36 | #endif // BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP | |
37 |