mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
Merge branch 'more_constexpr' into 'master'
Some more constexpr in esm/variant.cpp See merge request OpenMW/openmw!850
This commit is contained in:
commit
df3a47187b
1 changed files with 7 additions and 7 deletions
|
@ -10,20 +10,20 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const uint32_t STRV = ESM::FourCC<'S','T','R','V'>::value;
|
constexpr uint32_t STRV = ESM::FourCC<'S','T','R','V'>::value;
|
||||||
const uint32_t INTV = ESM::FourCC<'I','N','T','V'>::value;
|
constexpr uint32_t INTV = ESM::FourCC<'I','N','T','V'>::value;
|
||||||
const uint32_t FLTV = ESM::FourCC<'F','L','T','V'>::value;
|
constexpr uint32_t FLTV = ESM::FourCC<'F','L','T','V'>::value;
|
||||||
const uint32_t STTV = ESM::FourCC<'S','T','T','V'>::value;
|
constexpr uint32_t STTV = ESM::FourCC<'S','T','T','V'>::value;
|
||||||
|
|
||||||
template <typename T, bool orDefault = false>
|
template <typename T, bool orDefault = false>
|
||||||
struct GetValue
|
struct GetValue
|
||||||
{
|
{
|
||||||
T operator()(int value) const { return static_cast<T>(value); }
|
constexpr T operator()(int value) const { return static_cast<T>(value); }
|
||||||
|
|
||||||
T operator()(float value) const { return static_cast<T>(value); }
|
constexpr T operator()(float value) const { return static_cast<T>(value); }
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
T operator()(const V&) const
|
constexpr T operator()(const V&) const
|
||||||
{
|
{
|
||||||
if constexpr (orDefault)
|
if constexpr (orDefault)
|
||||||
return T {};
|
return T {};
|
||||||
|
|
Loading…
Reference in a new issue