DxLibEx
distance_result_type_t.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_BASIC_TYPES_DISTANCE_RESULT_TYPE_T_HPP_
9
#define DXLE_INC_BASIC_TYPES_DISTANCE_RESULT_TYPE_T_HPP_
10
#include "
dxlibex/type_traits/first_enabled.hpp
"
11
#include "
dxlibex/type_traits/enable_if.hpp
"
12
namespace
dxle
{
13
namespace
detail{
14
template<typename T, bool is_integral = std::is_integral<T>::value,
bool
is_float = std::is_floating_point<T>::value>
15
struct
distance_result_type_impl
;
16
template
<
typename
T>
17
struct
distance_result_type_impl
<T, false, true> {
18
typedef
T
type
;
19
};
20
template
<
typename
T>
21
struct
distance_result_type_impl
<T, true, false> {
22
typedef
double
type
;
//If any argument has integral type, it is cast to double.
23
};
24
}
25
template
<
typename
T1,
typename
T2>
struct
distance_result_type
:
dxle::detail::distance_result_type_impl
<decltype(std::declval<std::remove_cv_t<T1>>() - std::declval<std::remove_cv_t<T2>>())> {};
26
template
<
typename
T1,
typename
T2>
27
using
distance_result_type_t
=
typename
distance_result_type<T1, T2>::type
;
28
}
29
#endif //DXLE_INC_BASIC_TYPES_DISTANCE_RESULT_TYPE_T_HPP_
dxle::detail::distance_result_type_impl< T, false, true >::type
T type
Definition:
distance_result_type_t.hpp:18
dxle
Definition:
cast_if.hpp:12
dxle::detail::distance_result_type_impl< T, true, false >::type
double type
Definition:
distance_result_type_t.hpp:22
dxle::distance_result_type
Definition:
distance_result_type_t.hpp:25
dxle::detail::distance_result_type_impl
Definition:
distance_result_type_t.hpp:15
first_enabled.hpp
dxle::distance_result_type_t
typename distance_result_type< T1, T2 >::type distance_result_type_t
Definition:
distance_result_type_t.hpp:27
enable_if.hpp
dxlibex
basic_types
distance_result_type_t.hpp
Generated on Sun Jan 1 2017 10:49:50 for DxLibEx by
1.8.12