Skip to content

Commit

Permalink
build: Fix building errors with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
vasylskorych committed Dec 7, 2024
1 parent f8b5763 commit 5c23156
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
20 changes: 0 additions & 20 deletions ModelsAPI/UnitParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,6 @@
#include <set>
#include <utility>

template<>
EUnitParameter DeduceTypeConst<double>() { return EUnitParameter::CONSTANT_DOUBLE; }

template<>
EUnitParameter DeduceTypeConst<int64_t>() { return EUnitParameter::CONSTANT_INT64; }

template<>
EUnitParameter DeduceTypeConst<uint64_t>() { return EUnitParameter::CONSTANT_UINT64; }

///

template<>
EUnitParameter DeduceTypeList<double>() { return EUnitParameter::LIST_DOUBLE; }

template<>
EUnitParameter DeduceTypeList<int64_t>() { return EUnitParameter::LIST_INT64; }
template<>
EUnitParameter DeduceTypeList<uint64_t>() { return EUnitParameter::LIST_UINT64; }


////////////////////////////////////////////////////////////////////////////////////////////////////
/// CBaseUnitParameter

Expand Down
24 changes: 22 additions & 2 deletions ModelsAPI/UnitParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,30 @@
#define UP_MAX (std::numeric_limits<double>::max())

template<typename T>
constexpr EUnitParameter DeduceTypeConst();
constexpr EUnitParameter DeduceTypeConst()
{
if constexpr (std::is_same_v<T, double>)
return EUnitParameter::CONSTANT_DOUBLE;
else if constexpr (std::is_same_v<T, int64_t>)
return EUnitParameter::CONSTANT_INT64;
else if constexpr (std::is_same_v<T, uint64_t>)
return EUnitParameter::CONSTANT_UINT64;
else
return EUnitParameter::UNKNOWN;
}

template<typename T>
constexpr EUnitParameter DeduceTypeList();
constexpr EUnitParameter DeduceTypeList()
{
if constexpr (std::is_same_v<T, double>)
return EUnitParameter::LIST_DOUBLE;
else if constexpr (std::is_same_v<T, int64_t>)
return EUnitParameter::LIST_INT64;
else if constexpr (std::is_same_v<T, uint64_t>)
return EUnitParameter::LIST_UINT64;
else
return EUnitParameter::UNKNOWN;
}

/**
* \brief Base class for unit parameters.
Expand Down

0 comments on commit 5c23156

Please sign in to comment.