piranha  0.10
key_is_convertible.hpp
1 /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com)
2 
3 This file is part of the Piranha library.
4 
5 The Piranha library is free software; you can redistribute it and/or modify
6 it under the terms of either:
7 
8  * the GNU Lesser General Public License as published by the Free
9  Software Foundation; either version 3 of the License, or (at your
10  option) any later version.
11 
12 or
13 
14  * the GNU General Public License as published by the Free Software
15  Foundation; either version 3 of the License, or (at your option) any
16  later version.
17 
18 or both in parallel, as here.
19 
20 The Piranha library is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24 
25 You should have received copies of the GNU General Public License and the
26 GNU Lesser General Public License along with the Piranha library. If not,
27 see https://www.gnu.org/licenses/. */
28 
29 #ifndef PIRANHA_KEY_IS_CONVERTIBLE_HPP
30 #define PIRANHA_KEY_IS_CONVERTIBLE_HPP
31 
32 #include <type_traits>
33 
34 #include <piranha/is_key.hpp>
35 #include <piranha/symbol_utils.hpp>
36 #include <piranha/type_traits.hpp>
37 
38 namespace piranha
39 {
40 
42 
50 template <typename To, typename From>
52 {
53  PIRANHA_TT_CHECK(is_key, uncvref_t<To>);
54  PIRANHA_TT_CHECK(is_key, uncvref_t<From>);
55  static const bool implementation_defined
56  = std::is_constructible<uncvref_t<To>, const From &, const symbol_fset &>::value;
57 
58 public:
60  static const bool value = implementation_defined;
61 };
62 
63 template <typename To, typename From>
65 }
66 
67 #endif
Key type concept check.
Definition: is_key.hpp:65
boost::container::flat_set< std::string > symbol_fset
Flat set of symbols.
Root piranha namespace.
Definition: array_key.hpp:52
Type traits.
Detect if a key type is convertible to another key type.
static const bool value
Value of the type trait.