Added BOOST_NO_CXX17_ITERATOR_TRAITS macro.

The macro indicates that the standard library does not implement SFINAE-friendly
std::iterator_traits (LWG issue 2408, [iterator.traits]/2).
This commit is contained in:
Andrey Semashev
2017-07-12 20:37:47 +03:00
parent 3ffaa417c2
commit 34f320c4c9
20 changed files with 162 additions and 4 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
#
# Regression test Jamfile for boost configuration setup.
# *** DO NOT EDIT THIS FILE BY HAND ***
# This file was automatically generated on Mon May 29 10:27:35 2017
# This file was automatically generated on Sun Jul 9 16:30:35 2017
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
@@ -322,6 +322,9 @@ test-suite "BOOST_NO_CXX17_FOLD_EXPRESSIONS" :
test-suite "BOOST_NO_CXX17_INLINE_VARIABLES" :
[ run ../no_cxx17_inline_variables_pass.cpp ]
[ compile-fail ../no_cxx17_inline_variables_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_ITERATOR_TRAITS" :
[ run ../no_cxx17_iterator_traits_pass.cpp ]
[ compile-fail ../no_cxx17_iterator_traits_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_STD_APPLY" :
[ run ../no_cxx17_std_apply_pass.cpp ]
[ compile-fail ../no_cxx17_std_apply_fail.cpp ] ;
+49
View File
@@ -0,0 +1,49 @@
// Copyright (c) Andrey Semashev 2017.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_NO_CXX17_ITERATOR_TRAITS
// TITLE: C++17 std::iterator_traits
// DESCRIPTION: The compiler does not support SFINAE-friendly std::iterator_traits defined in C++17.
#include <iterator>
namespace boost_no_cxx17_iterator_traits {
struct iterator :
public std::iterator< std::random_access_iterator_tag, char >
{
};
struct non_iterator {};
template< typename T >
struct void_type { typedef void type; };
template< typename Traits, typename Void = void >
struct has_iterator_category
{
enum { value = false };
};
template< typename Traits >
struct has_iterator_category< Traits, typename void_type< typename Traits::iterator_category >::type >
{
enum { value = true };
};
int test()
{
if (!has_iterator_category< std::iterator_traits< boost_no_cxx17_iterator_traits::iterator > >::value)
return 1;
if (has_iterator_category< std::iterator_traits< boost_no_cxx17_iterator_traits::non_iterator > >::value)
return 2;
return 0;
}
}
+3
View File
@@ -1073,6 +1073,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CXX14_VARIABLE_TEMPLATES);
PRINT_MACRO(BOOST_NO_CXX17_FOLD_EXPRESSIONS);
PRINT_MACRO(BOOST_NO_CXX17_INLINE_VARIABLES);
PRINT_MACRO(BOOST_NO_CXX17_ITERATOR_TRAITS);
PRINT_MACRO(BOOST_NO_CXX17_STD_APPLY);
PRINT_MACRO(BOOST_NO_CXX17_STD_INVOKE);
PRINT_MACRO(BOOST_NO_CXX17_STRUCTURED_BINDINGS);
@@ -1139,6 +1140,8 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_USING_TEMPLATE);
PRINT_MACRO(BOOST_NO_VOID_RETURNS);
// END GENERATED BLOCK
PRINT_MACRO(BOOST_INTEL);
+11 -1
View File
@@ -1,4 +1,4 @@
// This file was automatically generated on Mon May 29 10:27:35 2017
// This file was automatically generated on Sun Jul 9 16:30:35 2017
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
@@ -342,6 +342,11 @@ namespace boost_no_cxx17_fold_expressions = empty_boost;
#else
namespace boost_no_cxx17_inline_variables = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_ITERATOR_TRAITS
#include "boost_no_cxx17_iterator_traits.ipp"
#else
namespace boost_no_cxx17_iterator_traits = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_STD_APPLY
#include "boost_no_cxx17_std_apply.ipp"
#else
@@ -1476,6 +1481,11 @@ int main( int, char *[] )
std::cerr << "Failed test for BOOST_NO_CXX17_INLINE_VARIABLES at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_cxx17_iterator_traits::test())
{
std::cerr << "Failed test for BOOST_NO_CXX17_ITERATOR_TRAITS at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_cxx17_std_apply::test())
{
std::cerr << "Failed test for BOOST_NO_CXX17_STD_APPLY at: " << __FILE__ << ":" << __LINE__ << std::endl;
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Sun Jul 9 15:26:23 2017
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_NO_CXX17_ITERATOR_TRAITS
// This file should not compile, if it does then
// BOOST_NO_CXX17_ITERATOR_TRAITS should not be defined.
// See file boost_no_cxx17_iterator_traits.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifdef BOOST_NO_CXX17_ITERATOR_TRAITS
#include "boost_no_cxx17_iterator_traits.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_no_cxx17_iterator_traits::test();
}
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Sun Jul 9 15:26:23 2017
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_NO_CXX17_ITERATOR_TRAITS
// This file should compile, if it does not then
// BOOST_NO_CXX17_ITERATOR_TRAITS should be defined.
// See file boost_no_cxx17_iterator_traits.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifndef BOOST_NO_CXX17_ITERATOR_TRAITS
#include "boost_no_cxx17_iterator_traits.ipp"
#else
namespace boost_no_cxx17_iterator_traits = empty_boost;
#endif
int main( int, char *[] )
{
return boost_no_cxx17_iterator_traits::test();
}