Fix not using constexpr-able version of strlen in strings
This commit is contained in:
parent
6937f1a885
commit
da5eb13d94
@ -19,10 +19,10 @@
|
|||||||
#ifndef REXY_STRING_BASE_TPP
|
#ifndef REXY_STRING_BASE_TPP
|
||||||
#define REXY_STRING_BASE_TPP
|
#define REXY_STRING_BASE_TPP
|
||||||
|
|
||||||
#include <utility> //forward, move, swap, etc
|
#include <utility> //move, etc
|
||||||
#include <cstring> //strlen, strcpy
|
#include <type_traits> //is_nothrow_invokable, is_nothrow_constructible
|
||||||
|
|
||||||
#include "utility.hpp" //max, memcpy
|
#include "utility.hpp" //max, memcpy, strlen
|
||||||
#include "detail/string_appender.hpp"
|
#include "detail/string_appender.hpp"
|
||||||
#include "algorithm.hpp"
|
#include "algorithm.hpp"
|
||||||
#include "compat/to_address.hpp"
|
#include "compat/to_address.hpp"
|
||||||
@ -42,7 +42,7 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
constexpr auto string_base<Char>::search(const_pointer c)const -> const_iterator{
|
constexpr auto string_base<Char>::search(const_pointer c)const -> const_iterator{
|
||||||
const auto len = strlen(c);
|
const auto len = rexy::strlen(c);
|
||||||
return two_way_search(cbegin(), cend(), c, c + len);
|
return two_way_search(cbegin(), cend(), c, c + len);
|
||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
@ -51,7 +51,7 @@ namespace rexy{
|
|||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
constexpr auto string_base<Char>::search(const_pointer c) -> iterator{
|
constexpr auto string_base<Char>::search(const_pointer c) -> iterator{
|
||||||
const auto len = strlen(c);
|
const auto len = rexy::strlen(c);
|
||||||
return two_way_search(begin(), end(), c, c + len);
|
return two_way_search(begin(), end(), c, c + len);
|
||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
@ -62,7 +62,7 @@ namespace rexy{
|
|||||||
template<class Char>
|
template<class Char>
|
||||||
template<class Searcher>
|
template<class Searcher>
|
||||||
constexpr auto string_base<Char>::search(const_pointer c, const Searcher& searcher)const -> const_iterator{
|
constexpr auto string_base<Char>::search(const_pointer c, const Searcher& searcher)const -> const_iterator{
|
||||||
const auto len = strlen(c);
|
const auto len = rexy::strlen(c);
|
||||||
return searcher(cbegin(), cend(), c, c + len);
|
return searcher(cbegin(), cend(), c, c + len);
|
||||||
}
|
}
|
||||||
template<class Char>
|
template<class Char>
|
||||||
@ -73,7 +73,7 @@ namespace rexy{
|
|||||||
template<class Char>
|
template<class Char>
|
||||||
template<class Searcher>
|
template<class Searcher>
|
||||||
constexpr auto string_base<Char>::search(const_pointer c, const Searcher& searcher) -> iterator{
|
constexpr auto string_base<Char>::search(const_pointer c, const Searcher& searcher) -> iterator{
|
||||||
const auto len = strlen(c);
|
const auto len = rexy::strlen(c);
|
||||||
return searcher(begin(), end(), c, c + len);
|
return searcher(begin(), end(), c, c + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ namespace rexy{
|
|||||||
constexpr basic_string<Char,Alloc>::basic_string(void)noexcept{}
|
constexpr basic_string<Char,Alloc>::basic_string(void)noexcept{}
|
||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
constexpr basic_string<Char,Alloc>::basic_string(rexy::steal<pointer> data)noexcept:
|
constexpr basic_string<Char,Alloc>::basic_string(rexy::steal<pointer> data)noexcept:
|
||||||
basic_string(data.value(), data.value() ? strlen(data.value()) : 0){}
|
basic_string(data.value(), data.value() ? rexy::strlen(data.value()) : 0){}
|
||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
constexpr basic_string<Char,Alloc>::basic_string(rexy::steal<pointer> data, size_type len)noexcept:
|
constexpr basic_string<Char,Alloc>::basic_string(rexy::steal<pointer> data, size_type len)noexcept:
|
||||||
string_base<Char>(data.value(), len, len){}
|
string_base<Char>(data.value(), len, len){}
|
||||||
@ -126,7 +126,7 @@ namespace rexy{
|
|||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>::basic_string(const_pointer data)
|
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>::basic_string(const_pointer data)
|
||||||
noexcept(is_nothrow_allocator_v<Alloc>):
|
noexcept(is_nothrow_allocator_v<Alloc>):
|
||||||
basic_string(data, data ? strlen(data) : 0){}
|
basic_string(data, data ? rexy::strlen(data) : 0){}
|
||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>::basic_string(size_type cap)
|
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>::basic_string(size_type cap)
|
||||||
noexcept(is_nothrow_allocator_v<Alloc>):
|
noexcept(is_nothrow_allocator_v<Alloc>):
|
||||||
@ -222,7 +222,7 @@ namespace rexy{
|
|||||||
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>& basic_string<Char,Alloc>::operator=(const_pointer c)
|
REXY_CPP20_CONSTEXPR basic_string<Char,Alloc>& basic_string<Char,Alloc>::operator=(const_pointer c)
|
||||||
noexcept(is_nothrow_allocator_v<Alloc>)
|
noexcept(is_nothrow_allocator_v<Alloc>)
|
||||||
{
|
{
|
||||||
return _copy_string(c, strlen(c));
|
return _copy_string(c, rexy::strlen(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Replace managed pointer. Frees existing value
|
//Replace managed pointer. Frees existing value
|
||||||
@ -230,7 +230,7 @@ namespace rexy{
|
|||||||
REXY_CPP20_CONSTEXPR void basic_string<Char,Alloc>::reset(pointer val)
|
REXY_CPP20_CONSTEXPR void basic_string<Char,Alloc>::reset(pointer val)
|
||||||
noexcept(is_nothrow_allocator_v<Alloc>)
|
noexcept(is_nothrow_allocator_v<Alloc>)
|
||||||
{
|
{
|
||||||
reset(val, val ? strlen(val) : 0);
|
reset(val, val ? rexy::strlen(val) : 0);
|
||||||
}
|
}
|
||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
REXY_CPP20_CONSTEXPR void basic_string<Char,Alloc>::reset(pointer val, size_type len)
|
REXY_CPP20_CONSTEXPR void basic_string<Char,Alloc>::reset(pointer val, size_type len)
|
||||||
@ -286,7 +286,7 @@ namespace rexy{
|
|||||||
noexcept(is_nothrow_allocator_v<Alloc>)
|
noexcept(is_nothrow_allocator_v<Alloc>)
|
||||||
{
|
{
|
||||||
if(data)
|
if(data)
|
||||||
append(data, strlen(data));
|
append(data, rexy::strlen(data));
|
||||||
}
|
}
|
||||||
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
template<class Char, REXY_ALLOCATOR_CONCEPT Alloc>
|
||||||
template<class InputIt>
|
template<class InputIt>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user