From 4bce7c57fab2baafcb651576e9a694d0e9a209f9 Mon Sep 17 00:00:00 2001 From: Thomas Nixon Date: Tue, 16 Jan 2024 12:07:07 +0000 Subject: [PATCH] NamedType: add move and copy assignments from T --- include/adm/detail/named_type.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/adm/detail/named_type.hpp b/include/adm/detail/named_type.hpp index b1fc4f27..66384a69 100644 --- a/include/adm/detail/named_type.hpp +++ b/include/adm/detail/named_type.hpp @@ -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& other) const {