diff options
-rwxr-xr-x | system/include/emscripten/bind.h | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index d5b2fe6a..ff7feacf 100755 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -1233,74 +1233,6 @@ namespace emscripten { TypeID<const ConstantType&>::get(), asGenericValue(BindingType<const ConstantType&>::toWireType(v))); } - - namespace internal { - template<typename T> - class optional { - public: - optional() - : initialized(false) - {} - - ~optional() { - if (initialized) { - get()->~T(); - } - } - - optional(const optional& rhs) - : initialized(false) - { - *this = rhs; - } - - T& operator*() { - assert(initialized); - return *get(); - } - - const T& operator*() const { - assert(initialized); - return *get(); - } - - explicit operator bool() const { - return initialized; - } - - optional& operator=(const T& v) { - if (initialized) { - get()->~T(); - } - new(get()) T(v); - initialized = true; - return *this; - } - - optional& operator=(const optional& o) { - if (initialized) { - get()->~T(); - } - if (o.initialized) { - new(get()) T(*o); - } - initialized = o.initialized; - return *this; - } - - private: - T* get() { - return reinterpret_cast<T*>(&data); - } - - T const* get() const { - return reinterpret_cast<T const*>(&data); - } - - bool initialized; - typename std::aligned_storage<sizeof(T)>::type data; - }; - } } namespace emscripten { |