Skip to content

Commit

Permalink
nullable: Allow nullable<const T&>::nullable(const nullable<T&>&)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceztko committed Dec 26, 2023
1 parent 1235a6b commit e2a1aa7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/podofo/auxiliary/nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ namespace PoDoFo
nullable(std::nullptr_t)
: m_hasValue(false), m_value{ } { }

// Allow nullable<const T&>::nullable(const nullable<T&>&)
template <typename T2, std::enable_if_t<std::is_convertible<std::add_pointer_t<std::remove_reference_t<T2>>,
std::add_pointer_t<std::remove_reference_t<T>>>::value, int> = 0>
nullable(const nullable<T2&>& value)
: m_hasValue(reinterpret_cast<const nullable&>(value).m_hasValue), m_value(reinterpret_cast<const nullable&>(value).m_value) { }

nullable(const nullable& value) = default;

nullable& operator=(const nullable& value) = default;
Expand Down

0 comments on commit e2a1aa7

Please sign in to comment.