Skip to content

Commit

Permalink
asserts() added for observers
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Jun 1, 2017
1 parent 7c0769e commit d1e4c25
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/include/opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ namespace mp {
}

// observers
constexpr const T* operator->() const { return reinterpret_cast<const T*>(&storage_); }
constexpr T* operator->() { return reinterpret_cast<T*>(&storage_); }
constexpr const T& operator*() const & { return *reinterpret_cast<const T*>(&storage_); }
constexpr T& operator*() & { return *reinterpret_cast<T*>(&storage_); }
constexpr T&& operator*() && { return std::move(*reinterpret_cast<T*>(&storage_)); }
constexpr const T&& operator*() const && { return std::move(*reinterpret_cast<const T*>(&storage_)); }
constexpr const T* operator->() const { assert(has_value()); return reinterpret_cast<const T*>(&storage_); }
constexpr T* operator->() { assert(has_value()); return reinterpret_cast<T*>(&storage_); }
constexpr const T& operator*() const & { assert(has_value()); return *reinterpret_cast<const T*>(&storage_); }
constexpr T& operator*() & { assert(has_value()); return *reinterpret_cast<T*>(&storage_); }
constexpr T&& operator*() && { assert(has_value()); return std::move(*reinterpret_cast<T*>(&storage_)); }
constexpr const T&& operator*() const && { assert(has_value()); return std::move(*reinterpret_cast<const T*>(&storage_)); }

constexpr bool has_value() const noexcept(noexcept(traits_type::has_value(std::declval<storage_type>())))
{
Expand Down

0 comments on commit d1e4c25

Please sign in to comment.