Skip to content

Commit

Permalink
constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Aug 30, 2024
1 parent 0739557 commit 732c187
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/ruis/util/dimension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class dimension
* @param len - the exact length, undefined length value is equivalent to 'min'.
*/
constexpr dimension(length len) :
type([&]() {
type([&]() constexpr {
if (len.is_undefined()) {
return dim::min;
} else {
Expand All @@ -91,18 +91,17 @@ class dimension
type(t)
{}

dim get_type() const noexcept
constexpr dim get_type() const noexcept
{
return this->type;
}

auto get_length() const noexcept
constexpr auto get_length() const noexcept
{
ASSERT(this->get_type() == dim::length)
return this->value;
}

bool is_undefined() const noexcept
constexpr bool is_undefined() const noexcept
{
return this->get_type() == dim::undefined;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ruis/util/length.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class length
value_units(u)
{}

bool is_undefined() const noexcept
constexpr bool is_undefined() const noexcept
{
return this->value < real(0);
}
Expand All @@ -76,7 +76,7 @@ class length
return this->get_internal(ctx);
}

bool operator==(const length& l) const noexcept
constexpr bool operator==(const length& l) const noexcept
{
return this->value == l.value && this->value_units == l.value_units;
}
Expand Down

0 comments on commit 732c187

Please sign in to comment.