diff --git a/checks/Jamfile.v2 b/checks/Jamfile.v2 index 2aec5db7..77b7e9d2 100644 --- a/checks/Jamfile.v2 +++ b/checks/Jamfile.v2 @@ -1,6 +1,6 @@ # # *** 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 @@ -111,6 +111,7 @@ obj cxx14_std_exchange : test_case.cpp : TEST_BOOST_NO_CXX14_STD_EXCHANG obj cxx14_variable_templates : test_case.cpp : TEST_BOOST_NO_CXX14_VARIABLE_TEMPLATES ; obj cxx17_fold_expressions : test_case.cpp : TEST_BOOST_NO_CXX17_FOLD_EXPRESSIONS ; obj cxx17_inline_variables : test_case.cpp : TEST_BOOST_NO_CXX17_INLINE_VARIABLES ; +obj cxx17_iterator_traits : test_case.cpp : TEST_BOOST_NO_CXX17_ITERATOR_TRAITS ; obj cxx17_std_apply : test_case.cpp : TEST_BOOST_NO_CXX17_STD_APPLY ; obj cxx17_std_invoke : test_case.cpp : TEST_BOOST_NO_CXX17_STD_INVOKE ; obj cxx17_structured_bindings : test_case.cpp : TEST_BOOST_NO_CXX17_STRUCTURED_BINDINGS ; diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 364af02e..05f921f1 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -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 @@ -511,6 +511,11 @@ # error "Defect macro BOOST_NO_CXX17_INLINE_VARIABLES is defined." # endif #endif +#ifdef TEST_BOOST_NO_CXX17_ITERATOR_TRAITS +# ifdef BOOST_NO_CXX17_ITERATOR_TRAITS +# error "Defect macro BOOST_NO_CXX17_ITERATOR_TRAITS is defined." +# endif +#endif #ifdef TEST_BOOST_NO_CXX17_STD_APPLY # ifdef BOOST_NO_CXX17_STD_APPLY # error "Defect macro BOOST_NO_CXX17_STD_APPLY is defined." diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 8f024ba7..94d0ca20 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -945,6 +945,7 @@ that are not yet supported by a particular compiler or library. [[Macro ][Description ]] [[`BOOST_NO_CXX17_STD_APPLY`][The compiler does not support `std::apply()`.]] [[`BOOST_NO_CXX17_STD_INVOKE`][The compiler does not support `std::invoke()`.]] +[[`BOOST_NO_CXX17_ITERATOR_TRAITS`][The compiler does not support SFINAE-friendly `std::iterator_traits`.]] ] [endsect] diff --git a/include/boost/config/stdlib/dinkumware.hpp b/include/boost/config/stdlib/dinkumware.hpp index daac5dfb..0af104d0 100644 --- a/include/boost/config/stdlib/dinkumware.hpp +++ b/include/boost/config/stdlib/dinkumware.hpp @@ -175,6 +175,7 @@ #endif #if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #endif #if defined(BOOST_INTEL) && (BOOST_INTEL <= 1400) diff --git a/include/boost/config/stdlib/libcomo.hpp b/include/boost/config/stdlib/libcomo.hpp index ce83f082..75ac2bb7 100644 --- a/include/boost/config/stdlib/libcomo.hpp +++ b/include/boost/config/stdlib/libcomo.hpp @@ -79,6 +79,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS // // Intrinsic type_traits support. diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index 9f3d259e..ad8aee32 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -97,6 +97,8 @@ # define BOOST_NO_AUTO_PTR #endif +#define BOOST_NO_CXX17_ITERATOR_TRAITS + #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL) // This is a bit of a sledgehammer, because really it's just libc++abi that has no // support for thread_local, leading to linker errors such as diff --git a/include/boost/config/stdlib/libstdcpp3.hpp b/include/boost/config/stdlib/libstdcpp3.hpp index 9adbc8f1..6cd420a6 100644 --- a/include/boost/config/stdlib/libstdcpp3.hpp +++ b/include/boost/config/stdlib/libstdcpp3.hpp @@ -247,6 +247,7 @@ extern "C" char *gets (char *__s); #if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11) # define BOOST_NO_CXX11_HDR_TYPEINDEX # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX17_ITERATOR_TRAITS #endif // C++0x features in GCC 4.7.0 and later diff --git a/include/boost/config/stdlib/modena.hpp b/include/boost/config/stdlib/modena.hpp index 98bdc3fb..81919e01 100644 --- a/include/boost/config/stdlib/modena.hpp +++ b/include/boost/config/stdlib/modena.hpp @@ -68,6 +68,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Modena C++ standard library" diff --git a/include/boost/config/stdlib/msl.hpp b/include/boost/config/stdlib/msl.hpp index 9606a9ae..0e2e2afe 100644 --- a/include/boost/config/stdlib/msl.hpp +++ b/include/boost/config/stdlib/msl.hpp @@ -92,5 +92,6 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/include/boost/config/stdlib/roguewave.hpp b/include/boost/config/stdlib/roguewave.hpp index 380d0ff3..df602155 100644 --- a/include/boost/config/stdlib/roguewave.hpp +++ b/include/boost/config/stdlib/roguewave.hpp @@ -204,3 +204,4 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS diff --git a/include/boost/config/stdlib/sgi.hpp b/include/boost/config/stdlib/sgi.hpp index 5016ff62..0c8ab2e4 100644 --- a/include/boost/config/stdlib/sgi.hpp +++ b/include/boost/config/stdlib/sgi.hpp @@ -162,5 +162,6 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "SGI standard library" diff --git a/include/boost/config/stdlib/stlport.hpp b/include/boost/config/stdlib/stlport.hpp index 81e6ccf0..2e304e2b 100644 --- a/include/boost/config/stdlib/stlport.hpp +++ b/include/boost/config/stdlib/stlport.hpp @@ -252,5 +252,6 @@ namespace boost { using std::min; using std::max; } // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/include/boost/config/stdlib/vacpp.hpp b/include/boost/config/stdlib/vacpp.hpp index c159af25..c4e1fb18 100644 --- a/include/boost/config/stdlib/vacpp.hpp +++ b/include/boost/config/stdlib/vacpp.hpp @@ -68,5 +68,6 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Visual Age default standard library" diff --git a/include/boost/config/stdlib/xlcpp_zos.hpp b/include/boost/config/stdlib/xlcpp_zos.hpp index dce40f50..4d5beb18 100644 --- a/include/boost/config/stdlib/xlcpp_zos.hpp +++ b/include/boost/config/stdlib/xlcpp_zos.hpp @@ -57,3 +57,4 @@ #define BOOST_NO_CXX17_STD_INVOKE #define BOOST_NO_CXX17_STD_APPLY +#define BOOST_NO_CXX17_ITERATOR_TRAITS diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index 78f4db2a..d8e1636d 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -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 ] ; diff --git a/test/boost_no_cxx17_iterator_traits.ipp b/test/boost_no_cxx17_iterator_traits.ipp new file mode 100644 index 00000000..ea75f232 --- /dev/null +++ b/test/boost_no_cxx17_iterator_traits.ipp @@ -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 + +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; +} + +} diff --git a/test/config_info.cpp b/test/config_info.cpp index 2a2a110d..65b7a875 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -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); diff --git a/test/config_test.cpp b/test/config_test.cpp index 93e838a6..446fa891 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -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; diff --git a/test/no_cxx17_iterator_traits_fail.cpp b/test/no_cxx17_iterator_traits_fail.cpp new file mode 100644 index 00000000..4b241c98 --- /dev/null +++ b/test/no_cxx17_iterator_traits_fail.cpp @@ -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 +#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(); +} + diff --git a/test/no_cxx17_iterator_traits_pass.cpp b/test/no_cxx17_iterator_traits_pass.cpp new file mode 100644 index 00000000..a2a29bb6 --- /dev/null +++ b/test/no_cxx17_iterator_traits_pass.cpp @@ -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 +#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(); +} +