Skip to content

Commit

Permalink
make NamedType constexpr-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Mar 25, 2018
1 parent 56abdaa commit 98f3ee7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions named_type_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class NamedType : public Skills<NamedType<T, Parameter, Skills...>>...
using UnderlyingType = T;

// constructor
explicit NamedType(T const& value) : value_(value) {}
explicit constexpr NamedType(T const& value) : value_(value) {}
template<typename T_ = T, typename = IsNotReference<T_>>
explicit NamedType(T&& value) : value_(std::move(value)) {}
explicit constexpr NamedType(T&& value) : value_(std::move(value)) {}

// get
T& get() { return value_; }
T const& get() const {return value_; }
constexpr T& get() { return value_; }
constexpr T const& get() const {return value_; }

// conversions
using ref = NamedType<T&, Parameter, Skills...>;
operator ref ()
Expand All @@ -50,7 +50,7 @@ class NamedType : public Skills<NamedType<T, Parameter, Skills...>>...
};

template<template<typename T> class StrongType, typename T>
StrongType<T> make_named(T const& value)
constexpr StrongType<T> make_named(T const& value)
{
return StrongType<T>(value);
}
Expand Down

0 comments on commit 98f3ee7

Please sign in to comment.