OGLplus (0.52.0) a C++ wrapper for OpenGL

optional.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_OBJECT_OPTIONAL_1107121519_HPP
14 #define OGLPLUS_OBJECT_OPTIONAL_1107121519_HPP
15 
16 #include <oglplus/detail/optional.hpp>
18 
19 namespace oglplus {
20 
22 
32 template <class Object>
33 class OptionalImpl<tag::Object, Object>
34  : public Object
35 {
36 public:
38 
47  OGLPLUS_NOEXCEPT(true)
48  : Object(typename Object::Uninitialized_())
49  { }
50 
52 
59  OptionalImpl(Object&& temp)
60  OGLPLUS_NOEXCEPT(true)
61  : Object(std::move(temp))
62  { }
63 
65  OptionalImpl(OptionalImpl&& temp)
66  OGLPLUS_NOEXCEPT(true)
67  : Object(static_cast<Object&&>(temp))
68  { }
69 
70  OptionalImpl& operator = (Object&& temp)
71  {
72  Object::operator=(std::move(temp));
73  return *this;
74  }
75 
77 
86  bool IsInitialized(void) const
87  OGLPLUS_NOEXCEPT(true)
88  {
89  return this->_name != 0u;
90  }
91 
92  OGLPLUS_EXPLICIT operator bool (void) const
93  {
94  return IsInitialized();
95  }
96 
98  Object Release(void)
99  OGLPLUS_NOEXCEPT(true)
100  {
101  return Object(static_cast<Object&&>(*this));
102  }
103 };
104 
105 } // namespace oglplus
106 
107 #endif // include guard
Object Release(void)
Releases the stored object and makes this Optional uninitialized.
Definition: optional.hpp:98
OptionalImpl(Object &&temp)
Construction of an initialized instance.
Definition: optional.hpp:59
bool IsInitialized(void) const
Returns true if the object is initialized, false otherwise.
Definition: optional.hpp:86
OptionalImpl(void)
Construction of an uninitialized instance.
Definition: optional.hpp:46
Template for object wrappers.
OptionalImpl(OptionalImpl &&temp)
Move constructor.
Definition: optional.hpp:65

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).