@@ -27,10 +27,10 @@ class string_view {
2727#endif
2828
2929public:
30- string_view () noexcept = default ;
31- string_view (const string_view &strn) noexcept = default ;
32- string_view (string_view &&strn) noexcept = default ;
33- string_view (std::string_view strn) noexcept
30+ constexpr string_view () noexcept = default;
31+ constexpr string_view (const string_view &strn) noexcept = default;
32+ constexpr string_view (string_view &&strn) noexcept = default;
33+ constexpr string_view (std::string_view strn) noexcept
3434 : str(strn.data())
3535#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
3636 ,
@@ -47,10 +47,10 @@ class string_view {
4747 {
4848 }
4949
50- string_view &operator =(string_view &&strn) noexcept = default ;
50+ constexpr string_view &operator =(string_view &&strn) noexcept = default ;
5151 string_view &operator =(const string_view &strn) noexcept = default ;
5252
53- string_view &operator =(std::string_view strn) noexcept {
53+ constexpr string_view &operator =(std::string_view strn) noexcept {
5454 str = strn.data ();
5555#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
5656 len = strn.size ();
@@ -66,9 +66,9 @@ class string_view {
6666 return *this ;
6767 }
6868
69- const char *data () const noexcept { return str ? str : " " ; }
69+ constexpr const char *data () const noexcept { return str ? str : " " ; }
7070
71- explicit operator std::string_view () const noexcept {
71+ constexpr explicit operator std::string_view () const noexcept {
7272#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
7373 return std::string_view (str, len);
7474#else
@@ -77,31 +77,39 @@ class string_view {
7777 }
7878
7979#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
80- friend bool operator ==(string_view lhs, std::string_view rhs) noexcept {
80+ friend constexpr bool operator ==(string_view lhs,
81+ std::string_view rhs) noexcept {
8182 return rhs == std::string_view (lhs);
8283 }
83- friend bool operator ==(std::string_view lhs, string_view rhs) noexcept {
84+ friend constexpr bool operator ==(std::string_view lhs,
85+ string_view rhs) noexcept {
8486 return lhs == std::string_view (rhs);
8587 }
8688
87- friend bool operator !=(string_view lhs, std::string_view rhs) noexcept {
89+ friend constexpr bool operator !=(string_view lhs,
90+ std::string_view rhs) noexcept {
8891 return rhs != std::string_view (lhs);
8992 }
90- friend bool operator !=(std::string_view lhs, string_view rhs) noexcept {
93+ friend constexpr bool operator !=(std::string_view lhs,
94+ string_view rhs) noexcept {
9195 return lhs != std::string_view (rhs);
9296 }
9397#else
94- friend bool operator ==(string_view lhs, std::string_view rhs) noexcept {
98+ friend constexpr bool operator ==(string_view lhs,
99+ std::string_view rhs) noexcept {
95100 return rhs == lhs.data ();
96101 }
97- friend bool operator ==(std::string_view lhs, string_view rhs) noexcept {
102+ friend constexpr bool operator ==(std::string_view lhs,
103+ string_view rhs) noexcept {
98104 return lhs == rhs.data ();
99105 }
100106
101- friend bool operator !=(string_view lhs, std::string_view rhs) noexcept {
107+ friend constexpr bool operator !=(string_view lhs,
108+ std::string_view rhs) noexcept {
102109 return rhs != lhs.data ();
103110 }
104- friend bool operator !=(std::string_view lhs, string_view rhs) noexcept {
111+ friend constexpr bool operator !=(std::string_view lhs,
112+ string_view rhs) noexcept {
105113 return lhs != rhs.data ();
106114 }
107115#endif
0 commit comments