Loading...
Searching...
No Matches
include
util
literal.h
Go to the documentation of this file.
1
#ifndef _BBM_LITERAL_H_
2
#define _BBM_LITERAL_H_
3
4
/************************************************************************/
5
/*! \file literal.h
6
7
\brief Work around for using floating point literals for compilers that
8
do not support it (e.g., Clang 14).
9
10
*************************************************************************/
11
12
namespace
bbm
{
13
14
template
<
typename
T=
int
>
15
struct
literal
16
{
17
using
type
= T;
18
19
//! \brief Constructor
20
inline
constexpr
literal
(T val=0) :
value
(val) {}
21
22
//! \brief Cast to T
23
inline
constexpr
operator
T(
void
)
const
{
return
value
; }
24
25
//! \brief data
26
T
value
;
27
};
28
29
}
// end bbm namespace
30
31
#endif
/* _BBM_LITERAL_H_ */
bbm
Definition:
aggregatebsdf.h:29
bbm::literal
Definition:
literal.h:16
bbm::literal::value
T value
data
Definition:
literal.h:26
bbm::literal::type
T type
Definition:
literal.h:17
bbm::literal::literal
constexpr literal(T val=0)
Constructor.
Definition:
literal.h:20