forked from boostorg/core
Compare commits
13 Commits
feature/po
...
feature/is
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f36d507f2 | ||
|
|
a77338b1cd | ||
|
|
965508d9e1 | ||
|
|
d03e58b77e | ||
|
|
f774295cdb | ||
|
|
c928c844da | ||
|
|
0a42ddabef | ||
|
|
04cc766db3 | ||
|
|
aa01ad8bf0 | ||
|
|
442e36f652 | ||
|
|
03040c7f5c | ||
|
|
8b31acf9a4 | ||
|
|
fd01cf788c |
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -310,15 +310,15 @@ jobs:
|
||||
- libc++-15-dev
|
||||
- libc++abi-15-dev
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: macos-11
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-12
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-13
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-14
|
||||
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{matrix.os}}
|
||||
@@ -611,9 +611,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@@ -678,9 +678,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@@ -755,9 +755,9 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
|
||||
@@ -33,7 +33,7 @@ template<class T, class N>
|
||||
void
|
||||
Allocator<T, N>::deallocate(pointer ptr, size_type)
|
||||
{
|
||||
if (!boost::pointer_in_range(ptr, &buffer_[0], &buffer_[N])) {
|
||||
if (!boost::pointer_in_range(ptr, buffer_, buffer_ + N)) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,9 @@ constexpr bool pointer_in_range(const T* ptr, const T* begin, const T* end);
|
||||
|
||||
[variablelist
|
||||
[[`template<class T> constexpr bool pointer_in_range(const T* ptr,
|
||||
const T* begin, T* end);`]
|
||||
const T* begin, const T* end);`]
|
||||
[[variablelist
|
||||
[[Requires][`[begin,end)` is a valid range.]]
|
||||
[[Returns][`true` if `ptr` is in range `[begin,end)`, otherwise `false`.]]]]]]
|
||||
|
||||
[endsect]
|
||||
|
||||
58
include/boost/core/detail/minstd_rand.hpp
Normal file
58
include/boost/core/detail/minstd_rand.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
#define BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
|
||||
// Copyright 2017 Peter Dimov
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
// An implementation of minstd_rand that does not require
|
||||
// the Random library
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class minstd_rand
|
||||
{
|
||||
private:
|
||||
|
||||
boost::uint_least32_t x_;
|
||||
|
||||
enum { a = 48271, m = 2147483647 };
|
||||
|
||||
public:
|
||||
|
||||
minstd_rand(): x_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
explicit minstd_rand( boost::uint_least32_t x ): x_( x % m )
|
||||
{
|
||||
if( x_ == 0 )
|
||||
{
|
||||
x_ = 1;
|
||||
}
|
||||
}
|
||||
|
||||
boost::uint_least32_t operator()()
|
||||
{
|
||||
boost::uint_least64_t y = x_;
|
||||
|
||||
y = ( a * y ) % m;
|
||||
|
||||
x_ = static_cast<boost::uint_least32_t>( y );
|
||||
|
||||
return x_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
@@ -74,7 +74,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -91,7 +91,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -150,7 +150,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
|
||||
@@ -199,7 +199,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -216,7 +216,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +262,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -283,7 +283,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
}
|
||||
|
||||
template<class End> BOOST_CXX14_CONSTEXPR basic_string_view( Ch const* first, End last,
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*> >::type* = 0 ) BOOST_NOEXCEPT: p_( first ), n_( last - first )
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*> >::type* = 0 ) BOOST_NOEXCEPT: p_( first ), n_( static_cast<size_type>( last - first ) )
|
||||
{
|
||||
BOOST_ASSERT( last - first >= 0 );
|
||||
}
|
||||
@@ -681,7 +681,7 @@ public:
|
||||
|
||||
Ch const* r = traits_type::find( data() + pos, size() - pos, c );
|
||||
|
||||
return r? r - data(): npos;
|
||||
return r? static_cast<size_type>( r - data() ): npos;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR size_type find( Ch const* s, size_type pos, size_type n ) const BOOST_NOEXCEPT
|
||||
@@ -696,11 +696,11 @@ public:
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
p = traits_type::find( p, last - p, s[0] );
|
||||
p = traits_type::find( p, static_cast<size_type>( last - p ), s[0] );
|
||||
|
||||
if( p == 0 ) break;
|
||||
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return p - data();
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return static_cast<size_type>( p - data() );
|
||||
|
||||
++p;
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ public:
|
||||
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str )
|
||||
{
|
||||
Ch const* p = str.data();
|
||||
std::streamsize n = str.size();
|
||||
std::streamsize n = static_cast<std::streamsize>( str.size() );
|
||||
|
||||
std::streamsize m = os.width();
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ inline void no_throw_failed_impl(const char* expr, const char* what, const char*
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
# pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
|
||||
// specialize test output for char pointers to avoid printing as cstring
|
||||
|
||||
@@ -351,8 +351,10 @@ private:
|
||||
detail::span_store<T, E> s_;
|
||||
};
|
||||
|
||||
#if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
|
||||
template<class T, std::size_t E>
|
||||
constexpr std::size_t span<T, E>::extent;
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_deduction_guides
|
||||
template<class I, class L>
|
||||
|
||||
@@ -103,7 +103,8 @@ inline std::string fix_typeid_name( char const* n )
|
||||
}
|
||||
|
||||
// class types can be incomplete
|
||||
template<class T> std::string typeid_name_impl( int T::* )
|
||||
// but also abstract (T[1] doesn't form)
|
||||
template<class T> std::string typeid_name_impl( int T::*, T(*)[1] )
|
||||
{
|
||||
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||
@@ -116,7 +117,7 @@ template<class T> std::string typeid_name_impl( ... )
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
return typeid_name_impl<T>( 0, 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
@@ -345,6 +346,8 @@ template<> struct tn_holder<boost::uint128_type>
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
|
||||
template<> struct tn_holder<wchar_t>
|
||||
{
|
||||
static std::string type_name( std::string const& suffix )
|
||||
@@ -353,6 +356,8 @@ template<> struct tn_holder<wchar_t>
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
template<> struct tn_holder<char16_t>
|
||||
|
||||
@@ -22,6 +22,15 @@ local warnings-as-errors-off =
|
||||
"-<toolset>gcc:<warnings-as-errors>on"
|
||||
"-<toolset>clang:<warnings-as-errors>on" ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>gcc:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
# quick test (for CI)
|
||||
run quick.cpp ;
|
||||
|
||||
@@ -34,7 +43,8 @@ compile addressof_constexpr_test.cpp ;
|
||||
compile-fail addressof_fail_rvalue.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run checked_delete_test.cpp ;
|
||||
run checked_delete_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile-fail checked_delete_fail.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail checked_delete_fail2.cpp
|
||||
@@ -101,13 +111,6 @@ run visit_each_test.cpp ;
|
||||
|
||||
run get_pointer_test.cpp ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
run lightweight_test_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run lightweight_test_test.cpp : : :
|
||||
@@ -334,33 +337,51 @@ run type_name_test.cpp ;
|
||||
|
||||
run snprintf_test.cpp ;
|
||||
|
||||
run sv_types_test.cpp ;
|
||||
run sv_construct_test.cpp ;
|
||||
run sv_iteration_test.cpp ;
|
||||
run sv_element_access_test.cpp ;
|
||||
run sv_modifiers_test.cpp ;
|
||||
run sv_copy_test.cpp ;
|
||||
run sv_substr_test.cpp ;
|
||||
run sv_compare_test.cpp ;
|
||||
run sv_starts_with_test.cpp ;
|
||||
run sv_ends_with_test.cpp ;
|
||||
run sv_find_test.cpp ;
|
||||
run sv_rfind_test.cpp ;
|
||||
run sv_types_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_construct_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_iteration_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_element_access_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_modifiers_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_copy_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_substr_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_compare_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_starts_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_ends_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_rfind_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_first_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_first_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp ;
|
||||
run sv_eq_test.cpp ;
|
||||
run sv_lt_test.cpp ;
|
||||
run sv_stream_insert_test.cpp ;
|
||||
run sv_conversion_test.cpp ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_eq_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_lt_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_stream_insert_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test2.cpp : ;
|
||||
run sv_common_reference_test.cpp ;
|
||||
run sv_common_reference_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile sv_common_reference_test2.cpp ;
|
||||
compile sv_windows_h_test.cpp ;
|
||||
compile-fail sv_nullptr_fail.cpp
|
||||
@@ -419,5 +440,8 @@ run yield_prim_pthread_cancel_test.cpp : ;
|
||||
run pointer_in_range_test.cpp ;
|
||||
compile pointer_in_range_constexpr_test.cpp ;
|
||||
|
||||
run minstd_rand_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
||||
38
test/minstd_rand_test.cpp
Normal file
38
test/minstd_rand_test.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Test for boost/core/detail/minstd_rand.hpp
|
||||
//
|
||||
// Copyright 2022, 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/minstd_rand.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::detail::minstd_rand rng;
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 48271;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 2076422031;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
{
|
||||
boost::detail::minstd_rand rng( 12345 );
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 595905495;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 1065162103;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
||||
@@ -426,14 +426,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), i );
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
||||
@@ -444,14 +444,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), i );
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,13 @@ template<class T1, class T2> struct X
|
||||
|
||||
template<class T1, class T2> struct Y;
|
||||
|
||||
class W
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
enum E1
|
||||
{
|
||||
e1
|
||||
@@ -122,6 +129,7 @@ int main()
|
||||
TEST(A);
|
||||
TEST(B);
|
||||
TEST(C);
|
||||
TEST(W);
|
||||
|
||||
TEST(E1);
|
||||
|
||||
@@ -143,6 +151,9 @@ int main()
|
||||
TEST(C&);
|
||||
TEST(C const&);
|
||||
|
||||
TEST(W const);
|
||||
TEST(W&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
TEST(B&&);
|
||||
@@ -156,6 +167,8 @@ int main()
|
||||
TEST(C*);
|
||||
TEST(C const* volatile*);
|
||||
|
||||
TEST(W volatile*);
|
||||
|
||||
TEST(void*);
|
||||
TEST(void const* volatile*);
|
||||
|
||||
@@ -307,6 +320,8 @@ int main()
|
||||
|
||||
TEST(std::pair<C, C>);
|
||||
|
||||
TEST(std::pair<W, W>);
|
||||
|
||||
TEST(std::pair<void, void>);
|
||||
TEST(std::pair<std::pair<void, void>, void>);
|
||||
|
||||
@@ -336,9 +351,11 @@ int main()
|
||||
TEST(X<A const&, B&> volatile&);
|
||||
|
||||
TEST(X<C, C>);
|
||||
TEST(X<W, W>);
|
||||
|
||||
TEST(Y<A, B>);
|
||||
TEST(Y<C, C>);
|
||||
TEST(Y<W, W>);
|
||||
|
||||
TEST(X<std::pair<void, void>, void>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user