aboutsummaryrefslogtreecommitdiff
path: root/src/irr_aabb3d.h
diff options
context:
space:
mode:
authorIlya Zhuravlev <zhuravlevilya@ya.ru>2014-02-02 16:22:33 +0400
committerkwolekr <kwolekr@minetest.net>2014-02-04 22:16:51 -0500
commit2d16ebf57c0a287c96f9575e5317230b27e66288 (patch)
tree5c9b6dbfdf50b77b1697372f15d0fa60c9c955ae /src/irr_aabb3d.h
parent3f376a092e1c16429fb52f24736e9da98aff4cd5 (diff)
downloadminetest-2d16ebf57c0a287c96f9575e5317230b27e66288.tar.gz
minetest-2d16ebf57c0a287c96f9575e5317230b27e66288.tar.bz2
minetest-2d16ebf57c0a287c96f9575e5317230b27e66288.zip
Fix unexpected preprocessor directive in gettext.cpp
Diffstat (limited to 'src/irr_aabb3d.h')
0 files changed, 0 insertions, 0 deletions
A 02110-1301 USA. */ #pragma once #include "debug.h" struct nullopt_t { }; constexpr nullopt_t nullopt{}; /** * An implementation of optional for C++11, which aims to be * compatible with a subset of std::optional features. * * Unfortunately, Minetest doesn't use C++17 yet. * * @tparam T The type to be stored */ template <typename T> class Optional { bool m_has_value = false; T m_value; public: Optional() noexcept {} Optional(nullopt_t) noexcept {} Optional(const T &value) noexcept : m_has_value(true), m_value(value) {} Optional(const Optional<T> &other) noexcept : m_has_value(other.m_has_value), m_value(other.m_value) { } void operator=(nullopt_t) noexcept { m_has_value = false; } void operator=(const Optional<T> &other) noexcept { m_has_value = other.m_has_value; m_value = other.m_value; } T &value() { FATAL_ERROR_IF(!m_has_value, "optional doesn't have value"); return m_value; } const T &value() const { FATAL_ERROR_IF(!m_has_value, "optional doesn't have value"); return m_value; } const T &value_or(const T &def) const { return m_has_value ? m_value : def; } bool has_value() const noexcept { return m_has_value; } explicit operator bool() const { return m_has_value; } };