The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
optional_fwd.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 - 2025
3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY.
11
12 See the COPYING file for more details.
13*/
14
15#pragma once
16
17#ifndef __APPLE__
18#include <optional>
19#else
20#include <boost/optional.hpp>
21#endif
22
23namespace utils
24{
25#ifndef __APPLE__
26
27using std::optional;
28using std::make_optional;
29using std::nullopt;
30using std::nullopt_t;
31using std::bad_optional_access;
32
33#else
34
35using boost::optional;
36using boost::make_optional;
37using boost::bad_optional_access;
38using nullopt_t = boost::none_t;
39
40// Create a new nullopt object equivalent to boost::none to match the STL interface
41static const boost::none_t nullopt{boost::none_t::init_tag{}};
42
43#endif
44
45} // end namespace utils