CNL  2.0.2 (development)
Compositional Numeric Library
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
from_value_recursive.h
1 
2 // Copyright John McFarlane 2019.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file ../LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #if !defined(CNL_IMPL_NUM_TRAITS_FROM_VALUE_RECURSIVE_H)
8 #define CNL_IMPL_NUM_TRAITS_FROM_VALUE_RECURSIVE_H
9 
10 #include "../config.h"
11 #include "from_rep.h"
12 #include "from_value.h"
13 #include "rep_of.h"
14 
15 namespace cnl {
16  namespace _impl {
17  template<class Number, typename Value>
18  struct from_value_recursive {
19  [[nodiscard]] constexpr auto operator()(Value const& value) const
20  {
21  return cnl::_impl::from_rep<Number>(cnl::_impl::from_value<rep_of_t<Number>>(value));
22  }
23  };
24  }
25 }
26 
27 #endif // CNL_IMPL_NUM_TRAITS_FROM_VALUE_RECURSIVE_H
cnl
compositional numeric library
Definition: abort.h:15