cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
identity.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_IDENTITY_H
4#define pRC_CORE_VALUE_IDENTITY_H
5
9
10namespace pRC
11{
12 template<IsValue T>
13 struct Identity<T>
14 {
15 constexpr T operator()() const
16 {
17 return 1;
18 }
19
20 template<class X>
22 constexpr T operator()(X &&value) const
23 {
24 return forward<X>(value);
25 }
26 };
27
28 template<>
29 struct Identity<Float<16>>
30 {
31 constexpr Float<16> operator()() const
32 {
33 return BFloat16::FromRepresentation(0x3F80);
34 }
35
36 template<class X>
37 requires IsConstructible<Float<16>, X>
38 constexpr Float<16> operator()(X &&value) const
39 {
40 return forward<X>(value);
41 }
42 };
43}
44#endif // pRC_CORE_VALUE_IDENTITY_H
static constexpr auto FromRepresentation(Representation const rep)
Definition bfloat16.hpp:24
Definition value.hpp:12
Definition concepts.hpp:37
int value
Definition gmock-actions_test.cc:1714
Definition cholesky.hpp:10
constexpr Float< 16 > operator()(X &&value) const
Definition identity.hpp:38
constexpr Float< 16 > operator()() const
Definition identity.hpp:31
constexpr T operator()(X &&value) const
Definition identity.hpp:22
constexpr T operator()() const
Definition identity.hpp:15
Definition identity.hpp:11