The Battle for Wesnoth  1.19.7+dev
any.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2022 - 2024
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 /**
18  * @file
19  *
20  * MacOS doesn't support std::any_cast when targing MacOS < 10.14 (currently we target 10.11).
21  * This provides a wrapper around the STL variant API on all platforms except MacOS, which
22  * instead utilizes boost::any.
23  */
24 
25 #ifdef __APPLE__
26 #define USING_BOOST_ANY
27 #endif
28 
29 #ifndef USING_BOOST_ANY
30 #include <any>
31 #else
32 #include <boost/any.hpp>
33 #endif
34 
35 namespace utils
36 {
37 #ifndef USING_BOOST_ANY
38 
39 using std::any;
40 using std::any_cast;
41 
42 #else
43 
44 using boost::any;
45 using boost::any_cast;
46 
47 #endif
48 } // namespace utils