From 98b24e1406a60283ed30288a99a76c9236e91703 Mon Sep 17 00:00:00 2001 From: Beman Date: Wed, 15 Jul 2015 20:41:24 -0400 Subject: [PATCH] Get rid of BOOST_CONSTEXPR for many signatures until compilers catch up with the expectations of the TS. Define _SCL_SECURE_NO_WARNINGS in test programs to quiet warnings. --- include/boost/utility/string_view.hpp | 70 +++++++++++++-------------- test/string_view_test1.cpp | 4 ++ test/string_view_test2.cpp | 4 ++ 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp index cc86b8e..a59515a 100644 --- a/include/boost/utility/string_view.hpp +++ b/include/boost/utility/string_view.hpp @@ -117,20 +117,20 @@ namespace boost { // modifiers void clear() BOOST_NOEXCEPT { len_ = 0; } // Boost extension - BOOST_CONSTEXPR void remove_prefix(size_type n) { + void remove_prefix(size_type n) { if ( n > len_ ) n = len_; ptr_ += n; len_ -= n; } - BOOST_CONSTEXPR void remove_suffix(size_type n) { + void remove_suffix(size_type n) { if ( n > len_ ) n = len_; len_ -= n; } - /*BOOST_CONSTEXPR*/ void swap(basic_string_view& s) BOOST_NOEXCEPT { + void swap(basic_string_view& s) BOOST_NOEXCEPT { std::swap(ptr_, s.ptr_); std::swap(len_, s.len_); } @@ -166,7 +166,7 @@ namespace boost { return rlen; } - BOOST_CONSTEXPR basic_string_view substr(size_type pos, size_type n=npos) const { + basic_string_view substr(size_type pos, size_type n=npos) const { if ( pos > size()) BOOST_THROW_EXCEPTION( std::out_of_range ( "string_view::substr" ) ); if ( n == npos || pos + n > size()) @@ -174,25 +174,25 @@ namespace boost { return basic_string_view ( data() + pos, n ); } - BOOST_CONSTEXPR int compare(basic_string_view x) const BOOST_NOEXCEPT { + int compare(basic_string_view x) const BOOST_NOEXCEPT { const int cmp = traits::compare ( ptr_, x.ptr_, (std::min)(len_, x.len_)); return cmp != 0 ? cmp : ( len_ == x.len_ ? 0 : len_ < x.len_ ? -1 : 1 ); } - BOOST_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string_view x) + int compare(size_type pos1, size_type n1, basic_string_view x) const BOOST_NOEXCEPT { return substr(pos1, n1).compare(x); } - BOOST_CONSTEXPR int compare(size_type pos1, size_type n1, + int compare(size_type pos1, size_type n1, basic_string_view x, size_type pos2, size_type n2) const { return substr(pos1, n1).compare(x.substr(pos2, n2)); } - BOOST_CONSTEXPR int compare(const charT* x) const { + int compare(const charT* x) const { return compare(basic_string_view(x)); } - BOOST_CONSTEXPR int compare(size_type pos1, size_type n1, const charT* x) const { + int compare(size_type pos1, size_type n1, const charT* x) const { return substr(pos1, n1).compare(basic_string_view(x)); } - BOOST_CONSTEXPR int compare(size_type pos1, size_type n1, + int compare(size_type pos1, size_type n1, const charT* x, size_type n2) const { return substr(pos1, n1).compare(basic_string_view(x, n2)); } @@ -344,7 +344,7 @@ namespace boost { // Comparison operators // Equality template - inline BOOST_CONSTEXPR bool operator==(basic_string_view x, + inline bool operator==(basic_string_view x, basic_string_view y) BOOST_NOEXCEPT { if ( x.size () != y.size ()) return false; return x.compare(y) == 0; @@ -352,7 +352,7 @@ namespace boost { // Inequality template - inline BOOST_CONSTEXPR bool operator!=(basic_string_view x, + inline bool operator!=(basic_string_view x, basic_string_view y) BOOST_NOEXCEPT { if ( x.size () != y.size ()) return true; return x.compare(y) != 0; @@ -360,7 +360,7 @@ namespace boost { // Less than template - inline BOOST_CONSTEXPR bool operator<(basic_string_view x, + inline bool operator<(basic_string_view x, basic_string_view y) BOOST_NOEXCEPT { return x.compare(y) < 0; } @@ -374,63 +374,63 @@ namespace boost { // Less than or equal to template - inline BOOST_CONSTEXPR bool operator<=(basic_string_view x, + inline bool operator<=(basic_string_view x, basic_string_view y) BOOST_NOEXCEPT { return x.compare(y) <= 0; } // Greater than or equal to template - inline BOOST_CONSTEXPR bool operator>=(basic_string_view x, + inline bool operator>=(basic_string_view x, basic_string_view y) BOOST_NOEXCEPT { return x.compare(y) >= 0; } // "sufficient additional overloads of comparison functions" template - inline BOOST_CONSTEXPR bool operator==(basic_string_view x, + inline bool operator==(basic_string_view x, const std::basic_string & y) BOOST_NOEXCEPT { return x == basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator==(const std::basic_string & x, + inline bool operator==(const std::basic_string & x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) == y; } template - inline BOOST_CONSTEXPR bool operator==(basic_string_view x, + inline bool operator==(basic_string_view x, const charT * y) BOOST_NOEXCEPT { return x == basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator==(const charT * x, + inline bool operator==(const charT * x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) == y; } template - inline BOOST_CONSTEXPR bool operator!=(basic_string_view x, + inline bool operator!=(basic_string_view x, const std::basic_string & y) BOOST_NOEXCEPT { return x != basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator!=(const std::basic_string & x, + inline bool operator!=(const std::basic_string & x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) != y; } template - inline BOOST_CONSTEXPR bool operator!=(basic_string_view x, + inline bool operator!=(basic_string_view x, const charT * y) BOOST_NOEXCEPT { return x != basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator!=(const charT * x, + inline bool operator!=(const charT * x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) != y; } @@ -460,73 +460,73 @@ namespace boost { } template - inline BOOST_CONSTEXPR bool operator>(basic_string_view x, + inline bool operator>(basic_string_view x, const std::basic_string & y) BOOST_NOEXCEPT { return x > basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator>(const std::basic_string & x, + inline bool operator>(const std::basic_string & x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) > y; } template - inline BOOST_CONSTEXPR bool operator>(basic_string_view x, + inline bool operator>(basic_string_view x, const charT * y) BOOST_NOEXCEPT { return x > basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator>(const charT * x, + inline bool operator>(const charT * x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) > y; } template - inline BOOST_CONSTEXPR bool operator<=(basic_string_view x, + inline bool operator<=(basic_string_view x, const std::basic_string & y) BOOST_NOEXCEPT { return x <= basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator<=(const std::basic_string & x, + inline bool operator<=(const std::basic_string & x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) <= y; } template - inline BOOST_CONSTEXPR bool operator<=(basic_string_view x, + inline bool operator<=(basic_string_view x, const charT * y) BOOST_NOEXCEPT { return x <= basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator<=(const charT * x, + inline bool operator<=(const charT * x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) <= y; } template - inline BOOST_CONSTEXPR bool operator>=(basic_string_view x, + inline bool operator>=(basic_string_view x, const std::basic_string & y) BOOST_NOEXCEPT { return x >= basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator>=(const std::basic_string & x, + inline bool operator>=(const std::basic_string & x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) >= y; } template - inline BOOST_CONSTEXPR bool operator>=(basic_string_view x, + inline bool operator>=(basic_string_view x, const charT * y) BOOST_NOEXCEPT { return x >= basic_string_view(y); } template - inline BOOST_CONSTEXPR bool operator>=(const charT * x, + inline bool operator>=(const charT * x, basic_string_view y) BOOST_NOEXCEPT { return basic_string_view(x) >= y; } diff --git a/test/string_view_test1.cpp b/test/string_view_test1.cpp index a8b0cd0..1f86013 100644 --- a/test/string_view_test1.cpp +++ b/test/string_view_test1.cpp @@ -7,6 +7,10 @@ For more information, see http://www.boost.org */ +#ifndef _SCL_SECURE_NO_WARNINGS +# define _SCL_SECURE_NO_WARNINGS +#endif + #include #include #include diff --git a/test/string_view_test2.cpp b/test/string_view_test2.cpp index 962ef98..7a1c880 100644 --- a/test/string_view_test2.cpp +++ b/test/string_view_test2.cpp @@ -7,6 +7,10 @@ For more information, see http://www.boost.org */ +#ifndef _SCL_SECURE_NO_WARNINGS +# define _SCL_SECURE_NO_WARNINGS +#endif + #include #include // for std::strchr