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