Skip to content

Commit 17fd977

Browse files
refactor: Adjust impl of primitive
1 parent 93ba980 commit 17fd977

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/primitive/impl.cppm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ template <underlying_type T, policy::policy_type... Policies> class primitive {
1212
public:
1313
using value_type = T;
1414
using policies = std::tuple<Policies...>;
15-
constexpr explicit primitive(T v) noexcept : value_(v) {}
15+
constexpr explicit primitive(value_type v) noexcept : value_(v) {}
1616
constexpr value_type &value() noexcept { return value_; }
17-
constexpr value_type const &value() const noexcept { return value_; }
17+
[[nodiscard]] constexpr value_type const &value() const noexcept { return value_; }
18+
constexpr explicit operator value_type() const noexcept { return value_; }
1819

1920
private:
20-
T value_;
21+
value_type value_;
2122
};
2223

23-
// `primitive_constant` removed: NTTP-based compile-time primitives
24-
// can be added later if needed. For MVP, keep only the runtime `primitive`.
25-
2624
} // namespace mcpplibs::primitives

0 commit comments

Comments
 (0)