Introduce feature-test macro BOOST_NO_CXX98_RANDOM_SHUFFLE

The algorithm std::random_shuffle was marked as deprecated in C++14 and is removed from the upcoming C++17 standard. The name itself is still reserved and library implementations may continue to ship it. In this sense, support for std::random_shuffle must be regarded as purely optional and a feature-test macro is required to test for its presence.

Signed-off-by: Daniela Engert <dani@ngrt.de>
This commit is contained in:
Daniela Engert
2017-04-09 08:59:41 +02:00
parent 8acd1c464d
commit f3cea5a8e4
3 changed files with 17 additions and 4 deletions

View File

@ -3770,7 +3770,7 @@
that describe C++17 features not supported</a> that describe C++17 features not supported</a>
</h3></div></div></div> </h3></div></div></div>
<p> <p>
The following macros describe features in the 2016 ISO C++ standard, formerly The following macros describe features in the 2017 ISO C++ standard, formerly
known as C++1z, that are not yet supported by a particular compiler or library. known as C++1z, that are not yet supported by a particular compiler or library.
</p> </p>
<div class="informaltable"><table class="table"> <div class="informaltable"><table class="table">
@ -3815,7 +3815,18 @@
</p> </p>
</td> </td>
</tr> </tr>
</tbody> <tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BOOST_NO_CXX98_RANDOM_SHUFFLE</span></code>
</p>
</td>
<td>
<p>
The compiler does no longer support <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">random_shuffle</span><span class="special">()</span></code>. It was deprecated in C++14 and is removed from C++17.
</p>
</td>
</tr></tbody>
</table></div> </table></div>
</div> </div>
<div class="section"> <div class="section">

View File

@ -936,13 +936,14 @@ provide compliant C++14 support.
[section Macros that describe C++17 features not supported] [section Macros that describe C++17 features not supported]
The following macros describe features in the 2016 ISO C++ standard, formerly known as C++1z, The following macros describe features in the 2017 ISO C++ standard, formerly known as C++1z,
that are not yet supported by a particular compiler or library. that are not yet supported by a particular compiler or library.
[table [table
[[Macro ][Description ]] [[Macro ][Description ]]
[[`BOOST_NO_CXX17_STD_APPLY`][The compiler does not support `std::apply()`.]] [[`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_STD_INVOKE`][The compiler does not support `std::invoke()`.]]
[[`BOOST_NO_CXX98_RANDOM_SHUFFLE`][The compiler does no longer support `std::random_shuffle()`. It was deprecated in C++14 and is removed from C++17.]]
] ]
[endsect] [endsect]

View File

@ -190,11 +190,12 @@
#endif #endif
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650) #if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650)
// If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr is not available. // If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr and std::random_shuffle are not available.
// See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++ // See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++
// and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx // and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0) # if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0)
# define BOOST_NO_AUTO_PTR # define BOOST_NO_AUTO_PTR
# define BOOST_NO_CXX98_RANDOM_SHUFFLE
# endif # endif
#endif #endif