CNL  2.0.2 (development)
Compositional Numeric Library
from_rep.h
Go to the documentation of this file.
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 
9 
10 #if !defined(CNL_IMPL_ELASTIC_INTEGER_FROM_REP_H)
11 #define CNL_IMPL_ELASTIC_INTEGER_FROM_REP_H
12 
13 #include "../num_traits/from_rep.h"
14 #include "definition.h"
15 #include "set_rep.h"
16 
18 namespace cnl {
19  template<int Digits, class Narrowest, class Rep>
20  struct from_rep<elastic_integer<Digits, Narrowest>, Rep> {
21  [[nodiscard]] constexpr auto operator()(Rep const& r) const
22  -> _impl::set_rep_t<elastic_integer<Digits, Narrowest>, Rep>
23  {
24  return r;
25  }
26  };
27 }
28 
29 #endif // CNL_IMPL_ELASTIC_INTEGER_FROM_REP_H
cnl
compositional numeric library
Definition: abort.h:15
cnl::elastic_integer
_impl::wrapper< typename elastic_tag< Digits, Narrowest >::rep, elastic_tag< Digits, Narrowest > > elastic_integer
An integer type with auto-widening operators.
Definition: definition.h:39