mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 23:03:54 +00:00
Add a deleted constructor from nullptr_t to string_view; closes #113
This commit is contained in:
parent
162a4e1d24
commit
1fa592c9ec
@ -403,6 +403,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||
# if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||
|
||||
basic_string_view( std::nullptr_t ) = delete;
|
||||
|
||||
# else
|
||||
|
||||
private:
|
||||
|
||||
basic_string_view( std::nullptr_t );
|
||||
|
||||
public:
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// BOOST_CONSTEXPR basic_string_view& operator=( basic_string_view const& ) BOOST_NOEXCEPT & = default;
|
||||
|
||||
// conversions
|
||||
|
@ -327,6 +327,8 @@ run sv_conversion_test2.cpp : ;
|
||||
run sv_common_reference_test.cpp ;
|
||||
compile sv_common_reference_test2.cpp ;
|
||||
compile sv_windows_h_test.cpp ;
|
||||
compile-fail sv_nullptr_fail.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
|
||||
run span_test.cpp ;
|
||||
run span_types_test.cpp ;
|
||||
|
10
test/sv_nullptr_fail.cpp
Normal file
10
test/sv_nullptr_fail.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2022 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
return boost::core::string_view( nullptr ).size() == 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user