proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
narrow.hpp
Go to the documentation of this file.
1#ifndef VEG_NARROW_HPP_H0EXKJTAS
2#define VEG_NARROW_HPP_H0EXKJTAS
3
4#include "proxsuite/fwd.hpp"
8
9namespace proxsuite {
10namespace linalg {
11namespace veg {
12namespace nb {
13template<typename To>
14struct narrow
15{
16 VEG_TEMPLATE((typename From),
17 requires VEG_CONCEPT(integral<From>) &&
19 constexpr auto
20 operator(),
21 (from, From))
22 const VEG_NOEXCEPT->To
23 {
24#if defined(VEG_WITH_CXX14_SUPPORT)
25
26 To to = static_cast<To>(from);
28 static_cast<From>(static_cast<To>(from));
30 return to;
31
32#else
34 static_cast<From>(static_cast<To>(from)) == from),
35 static_cast<To>(from);
36#endif
37 }
38};
39} // namespace nb
40VEG_NIEBLOID_TEMPLATE(typename To, narrow, To);
41} // namespace veg
42} // namespace linalg
43} // namespace proxsuite
44
46#endif /* end of include guard VEG_NARROW_HPP_H0EXKJTAS */
#define PROXSUITE_MAYBE_UNUSED
Definition fwd.hpp:20
#define VEG_CONCEPT(...)
Definition macros.hpp:1243
#define VEG_NIEBLOID_TEMPLATE(Tpl, Name,...)
Definition macros.hpp:547
#define VEG_INTERNAL_ASSERT_PRECONDITION
Definition prologue.hpp:100
#define VEG_NOEXCEPT
Definition prologue.hpp:30
VEG_TEMPLATE((typename From), requires VEG_CONCEPT(integral< From >) &&VEG_CONCEPT(integral< To >), constexpr auto operator(),(from, From)) const VEG_NOEXCEPT -> To
Definition narrow.hpp:16