mirror of
https://github.com/boostorg/core.git
synced 2025-07-30 12:57:26 +02:00
Merge pull request #164 from anarthal/develop
Constructor from std::string_view is now constexpr
This commit is contained in:
@ -392,7 +392,7 @@ public:
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||||
|
|
||||||
basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch> > const& str ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
BOOST_CONSTEXPR basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch> > const& str ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,11 @@ template<class It> std::reverse_iterator<It> make_reverse_iterator( It it )
|
|||||||
return std::reverse_iterator<It>( it );
|
return std::reverse_iterator<It>( it );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify that the constructor from std::string_view can be called in a constexpr context
|
||||||
|
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||||
|
static_assert(!boost::core::string_view(std::string_view("abc", 3)).empty());
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user