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
"
5
#include "
proxsuite/linalg/veg/util/assert.hpp
"
6
#include "
proxsuite/linalg/veg/internal/prologue.hpp
"
7
#include "
proxsuite/helpers/common.hpp
"
8
9
namespace
proxsuite
{
10
namespace
linalg {
11
namespace
veg {
12
namespace
nb {
13
template
<
typename
To>
14
struct
narrow
15
{
16
VEG_TEMPLATE
((
typename
From
),
17
requires
VEG_CONCEPT
(
integral<From>
) &&
18
VEG_CONCEPT
(
integral<To>
),
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
);
27
PROXSUITE_MAYBE_UNUSED
From
roundtrip_from
=
28
static_cast<
From
>
(
static_cast<
To
>
(
from
));
29
VEG_INTERNAL_ASSERT_PRECONDITION
(
roundtrip_from
==
from
);
30
return
to
;
31
32
#else
33
return
VEG_INTERNAL_ASSERT_PRECONDITION
(
34
static_cast<
From
>
(
static_cast<
To
>
(
from
)) ==
from
),
35
static_cast<
To
>
(
from
);
36
#endif
37
}
38
};
39
}
// namespace nb
40
VEG_NIEBLOID_TEMPLATE
(
typename
To
, narrow,
To
);
41
}
// namespace veg
42
}
// namespace linalg
43
}
// namespace proxsuite
44
45
#include "
proxsuite/linalg/veg/internal/epilogue.hpp
"
46
#endif
/* end of include guard VEG_NARROW_HPP_H0EXKJTAS */
assert.hpp
common.hpp
epilogue.hpp
fwd.hpp
PROXSUITE_MAYBE_UNUSED
#define PROXSUITE_MAYBE_UNUSED
Definition
fwd.hpp:20
VEG_CONCEPT
#define VEG_CONCEPT(...)
Definition
macros.hpp:1243
VEG_NIEBLOID_TEMPLATE
#define VEG_NIEBLOID_TEMPLATE(Tpl, Name,...)
Definition
macros.hpp:547
proxsuite
Definition
common.hpp:14
prologue.hpp
VEG_INTERNAL_ASSERT_PRECONDITION
#define VEG_INTERNAL_ASSERT_PRECONDITION
Definition
prologue.hpp:100
VEG_NOEXCEPT
#define VEG_NOEXCEPT
Definition
prologue.hpp:30
proxsuite::linalg::veg::Ref
Definition
ref.hpp:30
proxsuite::linalg::veg::nb::narrow
Definition
narrow.hpp:15
proxsuite::linalg::veg::nb::narrow::VEG_TEMPLATE
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
include
proxsuite
linalg
veg
internal
narrow.hpp
Generated by
1.10.0