| 1 | /*============================================================================== |
| 2 | Copyright (c) 2005-2010 Joel de Guzman |
| 3 | Copyright (c) 2015 John Fletcher |
| 4 | |
| 5 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 | ==============================================================================*/ |
| 8 | #ifndef BOOST_PHOENIX_CORE_IS_VALUE_HPP |
| 9 | #define BOOST_PHOENIX_CORE_IS_VALUE_HPP |
| 10 | |
| 11 | #include <boost/mpl/bool.hpp> |
| 12 | |
| 13 | // Copied from is_actor.hpp |
| 14 | |
| 15 | // Note to Thomas and any future maintainer: please make this as |
| 16 | // lightweight as possible (as it is right now). |
| 17 | |
| 18 | namespace boost { namespace phoenix |
| 19 | { |
| 20 | /////////////////////////////////////////////////////////////////////////////// |
| 21 | // |
| 22 | // is_value<T> |
| 23 | // |
| 24 | // Tests if T is a value. Evaluates to mpl::true_ or mpl::false_ |
| 25 | // |
| 26 | /////////////////////////////////////////////////////////////////////////////// |
| 27 | |
| 28 | namespace expression { |
| 29 | template <typename T> |
| 30 | struct value; |
| 31 | } |
| 32 | |
| 33 | template <typename T, typename Enable = void> |
| 34 | struct is_value |
| 35 | : mpl::false_ |
| 36 | {}; |
| 37 | |
| 38 | template <typename T> |
| 39 | struct is_value<T const> |
| 40 | : is_value<T> |
| 41 | {}; |
| 42 | |
| 43 | template <typename T> |
| 44 | struct is_value<T &> |
| 45 | : is_value<T> |
| 46 | {}; |
| 47 | |
| 48 | // This does not seem to work. |
| 49 | // There is an alternative in value.hpp which does work. |
| 50 | template <typename T> |
| 51 | struct is_value< expression::value<T> > |
| 52 | : mpl::true_ |
| 53 | {}; |
| 54 | |
| 55 | template <typename T> |
| 56 | bool is_val(T const & /* t */) |
| 57 | { |
| 58 | return is_value<T>::value; |
| 59 | } |
| 60 | |
| 61 | }} |
| 62 | |
| 63 | #endif |
| 64 | |