Skip to content

Commit

Permalink
NamedType: add move and copy assignments from T
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjnixon committed Jan 16, 2024
1 parent 0388a62 commit 4bce7c5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/adm/detail/named_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ namespace adm {
explicit NamedType(T&& value) : value_(std::move(value)) {
Validator::validate(get());
}

NamedType& operator=(const T& value) {
Validator::validate(value);
value_ = value;
return *this;
}
NamedType& operator=(T&& value) {
Validator::validate(value);
value_ = std::move(value);
return *this;
}

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

bool operator==(const NamedType<T, Tag, Validator>& other) const {
Expand Down

0 comments on commit 4bce7c5

Please sign in to comment.