The Battle for Wesnoth
1.17.17+dev
utils
ranges.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2021 - 2023
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
#include "
global.hpp
"
18
19
#ifdef HAVE_CXX20
20
#include <ranges>
21
#else
22
#include <boost/range/adaptor/reversed.hpp>
23
#endif
24
25
namespace
utils
26
{
27
template
<
typename
T>
28
inline
auto
reversed_view
(T& container)
29
{
30
#ifdef HAVE_CXX20
31
return
std::views::reverse(container);
32
#else
33
return
boost::adaptors::reverse(container);
34
#endif
35
}
36
37
}
// namespace utils
global.hpp
utils
Definition:
config_attribute_value.cpp:444
utils::reversed_view
auto reversed_view(T &container)
Definition:
ranges.hpp:28
Generated by
1.9.1