The Battle for Wesnoth  1.15.0-dev
functional.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by the Battle for Wesnoth Project http://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12  */
13 
14 /*
15  * Wrapper header to allow use of placeholder variables without a namespace.
16  */
17 
18 #pragma once
19 
20 #include <functional>
21 #include <boost/bind.hpp>
22 
23 // We'd like to just say "using namespace std::placeholders", but unfortunately
24 // that clashes with Boost.Bind's placeholders in some cases (even if bind.hpp is not included).
25 // Instead, we specialize std::is_placeholder for the Boost placeholders,
26 // so that Boost placeholders can be passed to std::bind.
27 
28 namespace std { // Some compilers can't handle it being specialized in the global scope
29  template<int N>
30  struct is_placeholder<boost::arg<N>> : public integral_constant<int, N> {};
31 }
STL namespace.