General header #include cleanup
This commit is contained in:
parent
50f6f81a05
commit
4e764d2205
@ -21,20 +21,20 @@
|
||||
|
||||
#include <utility> //forward, move
|
||||
#include <atomic> //memory_order, atomic
|
||||
#include <cstring> //memcpy
|
||||
#include "utility.hpp" //memcpy
|
||||
|
||||
namespace rexy{
|
||||
template<class T>
|
||||
mpmc_queue<T>::slot::slot(const slot& s):
|
||||
m_turn(s.m_turn.load(std::memory_order_acquire))
|
||||
{
|
||||
memcpy(m_data, s.m_data, sizeof(s.m_data));
|
||||
rexy::memcpy(m_data, s.m_data, sizeof(s.m_data));
|
||||
}
|
||||
template<class T>
|
||||
mpmc_queue<T>::slot::slot(slot&& s):
|
||||
m_turn(s.m_turn.load(std::memory_order_acquire))
|
||||
{
|
||||
memcpy(m_data, s.m_data, sizeof(s.m_data));
|
||||
rexy::memcpy(m_data, s.m_data, sizeof(s.m_data));
|
||||
}
|
||||
template<class T>
|
||||
mpmc_queue<T>::slot::~slot(){
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include <type_traits> //is_same, integral_contant, enable_if, etc
|
||||
#include <utility> //forward
|
||||
#include <cstddef> //std::size_t,ptrdiff
|
||||
#include <cstring> //strlen
|
||||
#include <climits> //CHAR_BIT
|
||||
#include <iterator> //reverse_iterator
|
||||
#include <iostream> //ostream
|
||||
|
||||
@ -41,11 +41,11 @@ namespace rexy{
|
||||
|
||||
template<class Char>
|
||||
constexpr basic_string_view<Char>::basic_string_view(const_pointer c)noexcept:
|
||||
basic_string_view(c, strlen(c)){}
|
||||
basic_string_view(c, rexy::strlen(c)){}
|
||||
template<class Char>
|
||||
constexpr basic_string_view<Char>& basic_string_view<Char>::operator=(const_pointer c)noexcept{
|
||||
m_data = c;
|
||||
m_length = strlen(c);
|
||||
m_length = rexy::strlen(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -21,14 +21,17 @@
|
||||
|
||||
#include <utility> //forward, move
|
||||
#include <cstddef> //size_t
|
||||
#include <type_traits>
|
||||
#include <cstring> //strlen, strcmp, memcpy
|
||||
#include <cwchar> //wcslen
|
||||
#include <type_traits> //too many to enumerate
|
||||
#include <string> //char_traits
|
||||
|
||||
#include "compat/if_consteval.hpp"
|
||||
#include "rexy.hpp"
|
||||
|
||||
#ifdef REXY_if_consteval
|
||||
#include <cstring> //strlen, strcmp, memcpy
|
||||
#include <cwchar> //wcslen
|
||||
#endif
|
||||
|
||||
namespace rexy{
|
||||
|
||||
namespace{
|
||||
@ -92,11 +95,12 @@ namespace rexy{
|
||||
return val > 0 ? val : -val;
|
||||
}
|
||||
|
||||
#ifdef REXY_if_consteval
|
||||
template<class T>
|
||||
constexpr std::size_t strlen(const T* c)noexcept{
|
||||
return std::char_traits<T>::length(c);
|
||||
}
|
||||
|
||||
#ifdef REXY_if_consteval
|
||||
template<class T>
|
||||
constexpr int strcmp(const T* l, const T* r)noexcept{
|
||||
REXY_if_not_consteval{
|
||||
@ -151,12 +155,6 @@ namespace rexy{
|
||||
}
|
||||
}
|
||||
#else // REXY_if_consteval
|
||||
template<class T>
|
||||
constexpr std::size_t strlen(const T* c)noexcept{
|
||||
std::size_t i = 0;
|
||||
for(;c[i];++i);
|
||||
return i;
|
||||
}
|
||||
template<class T>
|
||||
constexpr int strcmp(const T* l, const T* r)noexcept{
|
||||
for(;*l == *r && *l;++l, ++r);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#include "rexy/string.hpp"
|
||||
#include "rexy/allocator.hpp"
|
||||
#include "rexy/utility.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
#include <new>
|
||||
|
||||
@ -90,7 +90,7 @@ void check_short_construction(){
|
||||
}
|
||||
void check_long_construction(){
|
||||
const char* data = "this is a really long string that should ensure that it makes a dynamic allocation even if it has a big buffer.";
|
||||
std::size_t len = strlen(data);
|
||||
std::size_t len = rexy::strlen(data);
|
||||
test_str str1(data);
|
||||
if(str1.length() != len)
|
||||
error("long constructed string should be length() == strlen(data)\n");
|
||||
@ -171,7 +171,7 @@ void check_long_assignment(){
|
||||
const char* startdata1 = "this is another really long string that should ensure that it makes some sort of dyn alloc for big buf";
|
||||
const char* startdata2 = "zy";
|
||||
const char* data = "this is a really long string that should ensure that it makes a dynamic allocation even if it has a big buffer.";
|
||||
std::size_t len = strlen(data);
|
||||
std::size_t len = rexy::strlen(data);
|
||||
test_str str1(startdata1);
|
||||
str1 = data;
|
||||
if(str1.length() != len)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user