25 #ifndef __TPIE_MAYBE_H__
26 #define __TPIE_MAYBE_H__
29 #include <tpie/config.h>
39 maybe() : m_constructed(false) {
46 o.assert_not_constructed();
50 o.assert_not_constructed();
54 void assert_not_constructed()
const {
56 throw maybe_exception(
"Maybe object already constructed");
64 o.assert_not_constructed();
65 assert_not_constructed();
71 o.assert_not_constructed();
72 assert_not_constructed();
97 template <
typename ... T_ARGS>
99 assert_not_constructed();
101 new(&object) T(std::forward<T_ARGS>(args)...);
102 m_constructed =
true;
141 m_constructed =
false;