Add constructor to Optional<RefType> which accepts a RefType* in addition RefType& and nullptr. This is required since *nullptr is illegal and writing (ptr == nullptr) ? nullptr : *ptr isn't an efficient solution for the problem. (#45)
This commit is contained in:
committed by
Andreas Süßenbach
parent
952667d3c0
commit
3e3c16a0a1
@@ -208,11 +208,13 @@ namespace vk
|
||||
return flags ^ bit;
|
||||
}
|
||||
|
||||
|
||||
template <typename RefType>
|
||||
class Optional
|
||||
{
|
||||
public:
|
||||
Optional(RefType & reference) { m_ptr = &reference; }
|
||||
Optional(RefType * ptr) { m_ptr = ptr; }
|
||||
Optional(std::nullptr_t) { m_ptr = nullptr; }
|
||||
|
||||
operator RefType*() const { return m_ptr; }
|
||||
|
||||
Reference in New Issue
Block a user