#endif
#include <boost/foreach.hpp>
+/*
+ * Require C++11 when using GCC >= 4.8 to avoid ABI mismatch
+ * between the deprecated std::binary_function and modern C++ standard library.
+ */
+#if __cplusplus < 201103L && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
+#error "This header requires C++11 or higher when compiled with GCC >= 4.8. " \
+ "Otherwise we get an ABI mismatch."
+#endif
+
namespace I2n
{
typename ValueType
>
struct DefaultConverter
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
: public std::binary_function< std::string, ValueType&, bool >
+#endif
{
bool operator () ( const std::string& str, ValueType& v )
* just copies the input to the result var and returns true.
*/
template<> struct DefaultConverter< std::string >
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
: public std::binary_function< std::string, std::string&, bool >
+#endif
{
bool operator () ( const std::string& str, std::string& v )
typename ValueType
>
struct AutoIntConverter
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
: public std::binary_function< std::string, ValueType&, bool >
+#endif
{
bool operator () ( const std::string& str, ValueType& v )
* @brief represents a configuration variable with automatic update.
* @tparam ValueType type of the value this variable should hold.
* @tparam Converter a converter class which converts a string (from config file) to the desired
- * type.
- * Needs to be derived from std::binary_function (taking a string as first arg, a reference to the
- * desired type as second and returning bool (@a true if conversion was succesful).
+ * type. Must have an operator() taking (const std::string&, ValueType&) and returning bool.
*
* Basic idea is to pass a point (section, key) in the config where the value for this
* variable is stored. The config value (a string) should be converted to the desired value (type).
ValueType, Converter,
Detail::is_list_container< ValueType >::value >
{
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
BOOST_STATIC_ASSERT(( boost::is_base_of<
std::binary_function<
std::string,
>::type,
bool >,
Converter >::value ));
+#endif
typedef Detail::OuterSpace<
ValueType, Converter,