DxLibEx
is_castable.hpp
Go to the documentation of this file.
1 /*=============================================================================
2  Copyright (C) 2015-2017 DxLibEx project
3  https://github.com/Nagarei/DxLibEx/
4 
5  Distributed under the Boost Software License, Version 1.0.
6  (See http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #ifndef DXLE_INC_TYPE_TRAITS_IS_CASTABLE_HPP_
9 #define DXLE_INC_TYPE_TRAITS_IS_CASTABLE_HPP_
10 #include <type_traits>
11 namespace dxle {
13 namespace type_traits {
14 
15  template<typename From, typename To>
16  struct is_castable : std::conditional<
17  std::is_constructible<To, From>::value && std::is_convertible<From, To>::value,
18  std::true_type, std::false_type
19  >::type {};
20 
21 }//namespace
22 using namespace type_traits;
23 }
24 #endif //DXLE_INC_TYPE_TRAITS_IS_CASTABLE_HPP_
Definition: cast_if.hpp:12