Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid constexpr error for cxx14 #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions include/hyperjet/hyperjet.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include <vector> // vector
#include <unordered_map> // unordered_map

#define MIMIC_FUNCTION(...) \
do { __VA_ARGS__ } while(0)

#define UNUSED_VARIABLE(X) MIMIC_FUNCTION((void)X;)

namespace hyperjet
{

Expand Down Expand Up @@ -225,6 +230,9 @@ namespace hyperjet

if constexpr (TOrder < 1 || (std::is_same_v<TDa, Zero> && std::is_same_v<TDb, Zero>))
{
UNUSED_VARIABLE(daa);
UNUSED_VARIABLE(dab);
UNUSED_VARIABLE(dbb);
return;
}
else
Expand All @@ -244,7 +252,10 @@ namespace hyperjet

if constexpr (TOrder < 2 || (std::is_same_v<TDaa, Zero> && std::is_same_v<TDab, Zero> && std::is_same_v<TDbb, Zero>))
{
return;
UNUSED_VARIABLE(daa);
UNUSED_VARIABLE(dab);
UNUSED_VARIABLE(dbb);
return;
}
else
{
Expand Down Expand Up @@ -312,7 +323,7 @@ namespace hyperjet
}

public:
DDScalar()
DDScalar(): m_size(DataSize), m_data({})
{
static_assert(0 < order() && order() <= 2);

Expand All @@ -327,7 +338,7 @@ namespace hyperjet
}
}

DDScalar(const TScalar f)
constexpr DDScalar(const TScalar f) : m_size(DataSize), m_data({})
{
static_assert(0 < order() && order() <= 2);

Expand All @@ -341,10 +352,9 @@ namespace hyperjet
static_assert(TSize >= 0);
}
this->f() = f;
std::fill(m_data.begin() + 1, m_data.end(), 0);
}

DDScalar(const Data &data) : m_data(data)
DDScalar(const Data &data) : m_size(DataSize), m_data(data)
{
static_assert(0 < order() && order() <= 2);

Expand Down Expand Up @@ -704,7 +714,7 @@ namespace hyperjet
}
}

Scalar &f()
constexpr Scalar &f()
{
return m_data[0];
}
Expand Down