add <cstring> and <cwchar> compatible constexpr functions

This commit is contained in:
bolero-MURAKAMI 2014-04-23 01:27:03 +09:00
parent fe255a5e74
commit b04dea6002
26 changed files with 526 additions and 103 deletions

View file

@ -35,7 +35,7 @@ Supported Compilers
Linux:
* GCC, C++11 mode: 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.8.0, 4.8.1, 4.8.2
* GCC, C++11 mode: 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.8.0, 4.8.1, 4.8.2, 4.9.0
* Clang, C++11 mode: 3.2, 3.3, 3.4
*******************************************************************************

View file

@ -9,6 +9,12 @@
#define SPROUT_CSTRING_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/memcpy.hpp>
#include <sprout/cstring/memmove.hpp>
#include <sprout/cstring/strcpy.hpp>
#include <sprout/cstring/strncpy.hpp>
#include <sprout/cstring/strcat.hpp>
#include <sprout/cstring/strncat.hpp>
#include <sprout/cstring/memcmp.hpp>
#include <sprout/cstring/strcmp.hpp>
#include <sprout/cstring/strcoll.hpp>
@ -20,6 +26,7 @@
#include <sprout/cstring/strrchr.hpp>
#include <sprout/cstring/strspn.hpp>
#include <sprout/cstring/strstr.hpp>
#include <sprout/cstring/memset.hpp>
#include <sprout/cstring/strlen.hpp>
#endif // #ifndef SPROUT_CSTRING_HPP

View file

@ -18,19 +18,6 @@
namespace sprout {
namespace detail {
inline SPROUT_CONSTEXPR unsigned char const*
memchr_impl(unsigned char const* found, unsigned char const* last) {
return found == last ? nullptr
: found
;
}
inline SPROUT_CONSTEXPR unsigned char*
memchr_impl(unsigned char* found, unsigned char* last) {
return found == last ? nullptr
: found
;
}
template<typename T>
struct memchr_result {
private:
@ -40,6 +27,27 @@ namespace sprout {
public:
typedef decltype(check(std::declval<T>())) type;
};
template<typename PtrIterator>
inline SPROUT_CONSTEXPR PtrIterator
memchr_impl(PtrIterator found, PtrIterator last) {
return found == last ? nullptr
: found
;
}
template<typename PtrIterator, typename T>
inline SPROUT_CONSTEXPR PtrIterator
memchr(PtrIterator s, T c, std::size_t n) {
return sprout::detail::memchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(s), sprout::ptr_index(s, n),
c
)
),
s + n
);
}
} // namespace detail
// 7.21.5.1 memchr ŠÖ<C5A0>
@ -50,28 +58,12 @@ namespace sprout {
#if 0
inline SPROUT_CONSTEXPR void const*
memchr(void const* s, int c, std::size_t n) {
return sprout::detail::memchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(static_cast<unsigned char const*>(s)), sprout::ptr_index(static_cast<unsigned char const*>(s), n),
static_cast<unsigned char>(c)
)
),
static_cast<unsigned char const*>(s) + n
);
return sprout::detail::memchr(static_cast<unsigned char const*>(s), static_cast<unsigned char>(c), n);
}
inline SPROUT_CONSTEXPR void*
memchr(void* s, int c, std::size_t n) {
return sprout::detail::memchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(static_cast<unsigned char*>(s)), sprout::ptr_index(static_cast<unsigned char*>(s), n),
static_cast<unsigned char>(c)
)
),
static_cast<unsigned char*>(s) + n
);
return sprout::detail::memchr(static_cast<unsigned char*>(s), static_cast<unsigned char>(c), n);
}
#endif
template<
@ -80,15 +72,7 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR void const*
memchr(T s, int c, std::size_t n) {
return sprout::detail::memchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(static_cast<unsigned char const*>(s)), sprout::ptr_index(static_cast<unsigned char const*>(s), n),
static_cast<unsigned char>(c)
)
),
static_cast<unsigned char const*>(s) + n
);
return sprout::detail::memchr(static_cast<unsigned char const*>(s), static_cast<unsigned char>(c), n);
}
template<
@ -97,15 +81,7 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR void*
memchr(T s, int c, std::size_t n) {
return sprout::detail::memchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(static_cast<unsigned char*>(s)), sprout::ptr_index(static_cast<unsigned char*>(s), n),
static_cast<unsigned char>(c)
)
),
static_cast<unsigned char*>(s) + n
);
return sprout::detail::memchr(static_cast<unsigned char*>(s), static_cast<unsigned char>(c), n);
}
} // namespace sprout

View file

@ -16,6 +16,17 @@
#include <sprout/algorithm/tristate_lexicographical_compare.hpp>
namespace sprout {
namespace detail {
template<typename PtrIterator>
inline SPROUT_CONSTEXPR int
memcmp(PtrIterator s1, PtrIterator s2, std::size_t n) {
return sprout::tristate_lexicographical_compare(
sprout::ptr_index(s1), sprout::ptr_index(s1, n),
sprout::ptr_index(s2), sprout::ptr_index(s2, n)
);
}
} // namespace detail
// 7.21.4.1 memcmp ŠÖ<C5A0>
//
// recursion depth:
@ -24,10 +35,7 @@ namespace sprout {
#if 0
inline SPROUT_CONSTEXPR int
memcmp(void const* s1, void const* s2, std::size_t n) {
return sprout::tristate_lexicographical_compare(
sprout::ptr_index(static_cast<unsigned char const*>(s1)), sprout::ptr_index(static_cast<unsigned char const*>(s1), n),
sprout::ptr_index(static_cast<unsigned char const*>(s2)), sprout::ptr_index(static_cast<unsigned char const*>(s2), n)
);
return sprout::detail::memcmp(static_cast<unsigned char const*>(s1), static_cast<unsigned char const*>(s2), n);
}
#endif
template<
@ -36,10 +44,7 @@ namespace sprout {
>
inline SPROUT_CONSTEXPR int
memcmp(T s1, T s2, std::size_t n) {
return sprout::tristate_lexicographical_compare(
sprout::ptr_index(static_cast<unsigned char const*>(s1)), sprout::ptr_index(static_cast<unsigned char const*>(s1), n),
sprout::ptr_index(static_cast<unsigned char const*>(s2)), sprout::ptr_index(static_cast<unsigned char const*>(s2), n)
);
return sprout::detail::memcmp(static_cast<unsigned char const*>(s1), static_cast<unsigned char const*>(s2), n);
}
} // namespace sprout

39
sprout/cstring/memcpy.hpp Normal file
View file

@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_MEMCPY_HPP
#define SPROUT_CSTRING_MEMCPY_HPP
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/cxx14/copy.hpp>
namespace sprout {
namespace detail {
template<typename PtrIterator, typename ConstPtrIterator>
inline SPROUT_CXX14_CONSTEXPR PtrIterator
memcpy(PtrIterator s1, ConstPtrIterator s2, std::size_t n) {
sprout::copy(s2, s2 + n, s1);
return s1;
}
} // namespace detail
// 7.21.2.1 The memcpy function
//
template<
typename T, typename CT,
typename sprout::enabler_if<std::is_convertible<T, void*>::value && std::is_convertible<CT, void const*>::value>::type = sprout::enabler
>
inline SPROUT_CXX14_CONSTEXPR void*
memcpy(T s1, CT s2, std::size_t n) {
return sprout::detail::memcpy(static_cast<unsigned char*>(s1), static_cast<unsigned char const*>(s2), n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_MEMCPY_HPP

View file

@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_MEMMOVE_HPP
#define SPROUT_CSTRING_MEMMOVE_HPP
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/cxx14/copy_backward.hpp>
namespace sprout {
namespace detail {
template<typename PtrIterator, typename ConstPtrIterator>
inline SPROUT_CXX14_CONSTEXPR PtrIterator
memmove(PtrIterator s1, ConstPtrIterator s2, std::size_t n) {
sprout::copy_backward(s2, s2 + n, s1);
return s1;
}
} // namespace detail
// 7.21.2.2 The memmove function
//
template<
typename T, typename CT,
typename sprout::enabler_if<std::is_convertible<T, void*>::value && std::is_convertible<CT, void const*>::value>::type = sprout::enabler
>
inline SPROUT_CXX14_CONSTEXPR void*
memmove(T s1, CT s2, std::size_t n) {
return sprout::detail::memmove(static_cast<unsigned char*>(s1), static_cast<unsigned char const*>(s2), n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_MEMMOVE_HPP

39
sprout/cstring/memset.hpp Normal file
View file

@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_MEMSET_HPP
#define SPROUT_CSTRING_MEMSET_HPP
#include <cstddef>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/cxx14/fill.hpp>
namespace sprout {
namespace detail {
template<typename PtrIterator, typename T>
inline SPROUT_CXX14_CONSTEXPR PtrIterator
memset(PtrIterator s, T c, std::size_t n) {
sprout::fill(s, s + n, c);
return s;
}
} // namespace detail
// 7.21.6.1 The memset function
//
template<
typename T,
typename sprout::enabler_if<std::is_convertible<T, void*>::value>::type = sprout::enabler
>
inline SPROUT_CXX14_CONSTEXPR void*
memset(T s, int c, std::size_t n) {
return sprout::detail::memset(static_cast<unsigned char*>(s), static_cast<unsigned char>(c), n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_MEMSET_HPP

41
sprout/cstring/strcat.hpp Normal file
View file

@ -0,0 +1,41 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_STRCAT_HPP
#define SPROUT_CSTRING_STRCAT_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace detail {
template<typename OutputCStrIterator, typename CStrIterator>
inline SPROUT_CXX14_CONSTEXPR OutputCStrIterator
strcat(OutputCStrIterator s1, CStrIterator s2) {
OutputCStrIterator result = s1;
while (*s1++)
;
while (*s1++ = *s2++)
;
return result;
}
} // namespace detail
// 7.21.3.1 The strcat function
//
inline SPROUT_CXX14_CONSTEXPR char*
strcat(char* s1, char const* s2) {
return sprout::detail::strcat(s1, s2);
}
template<typename Elem>
inline SPROUT_CXX14_CONSTEXPR Elem*
strcat(Elem* s1, Elem const* s2) {
return sprout::detail::strcat(s1, s2);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_STRCAT_HPP

View file

@ -14,6 +14,7 @@
#include <sprout/cstring/strcmp.hpp>
namespace sprout {
// 7.21.4.3 strcoll ŠÖ<C5A0>
//
// recursion depth:

39
sprout/cstring/strcpy.hpp Normal file
View file

@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_STRCPY_HPP
#define SPROUT_CSTRING_STRCPY_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace detail {
template<typename OutputCStrIterator, typename CStrIterator>
inline SPROUT_CXX14_CONSTEXPR OutputCStrIterator
strcpy(OutputCStrIterator s1, CStrIterator s2) {
OutputCStrIterator result = s1;
while (*s1++ = *s2++)
;
return result;
}
} // namespace detail
// 7.21.2.3 The strcpy function
//
inline SPROUT_CXX14_CONSTEXPR char*
strcpy(char* s1, char const* s2) {
return sprout::detail::strcpy(s1, s2);
}
template<typename Elem>
inline SPROUT_CXX14_CONSTEXPR Elem*
strcpy(Elem* s1, Elem const* s2) {
return sprout::detail::strcpy(s1, s2);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_STRCPY_HPP

View file

@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_STRNCAT_HPP
#define SPROUT_CSTRING_STRNCAT_HPP
#include <iterator>
#include <sprout/config.hpp>
namespace sprout {
namespace detail {
template<typename OutputCStrIterator, typename CStrIterator>
inline SPROUT_CXX14_CONSTEXPR OutputCStrIterator
strncat(OutputCStrIterator s1, CStrIterator s2, std::size_t n) {
typedef typename std::iterator_traits<OutputCStrIterator>::value_type value_type;
OutputCStrIterator result = s1;
while (*s1) {
++s1;
}
while (n) {
--n;
if (!(*s1++ = *s2++)) {
break;
}
}
*s1 = value_type();
return result;
}
} // namespace detail
// 7.21.3.2 The strncat function
//
inline SPROUT_CXX14_CONSTEXPR char*
strncat(char* s1, char const* s2, std::size_t n) {
return sprout::detail::strncat(s1, s2, n);
}
template<typename Elem>
inline SPROUT_CXX14_CONSTEXPR Elem*
strncat(Elem* s1, Elem const* s2, std::size_t n) {
return sprout::detail::strncat(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_STRNCAT_HPP

View file

@ -16,6 +16,7 @@
#include <sprout/algorithm/tristate_lexicographical_compare.hpp>
namespace sprout {
// 7.21.4.4 strncmp ŠÖ<C5A0>
//
// recursion depth:

View file

@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_STRNCPY_HPP
#define SPROUT_CSTRING_STRNCPY_HPP
#include <iterator>
#include <sprout/config.hpp>
namespace sprout {
namespace detail {
template<typename OutputCStrIterator, typename CStrIterator>
inline SPROUT_CXX14_CONSTEXPR OutputCStrIterator
strncpy(OutputCStrIterator s1, CStrIterator s2, std::size_t n) {
typedef typename std::iterator_traits<OutputCStrIterator>::value_type value_type;
OutputCStrIterator result = s1;
while (n) {
--n;
if (!(*s1++ = *s2++)) {
break;
}
}
while (n) {
--n;
*s1++ = value_type();
}
return result;
}
} // namespace detail
// 7.21.2.4 The strncpy function
//
inline SPROUT_CXX14_CONSTEXPR char*
strncpy(char* s1, char const* s2, std::size_t n) {
return sprout::detail::strncpy(s1, s2, n);
}
template<typename Elem>
inline SPROUT_CXX14_CONSTEXPR Elem*
strncpy(Elem* s1, Elem const* s2, std::size_t n) {
return sprout::detail::strncpy(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_STRNCPY_HPP

View file

@ -9,6 +9,12 @@
#define SPROUT_CWCHER_HPP
#include <sprout/config.hpp>
#include <sprout/cwchar/wcscpy.hpp>
#include <sprout/cwchar/wcsncpy.hpp>
#include <sprout/cwchar/wmemcpy.hpp>
#include <sprout/cwchar/wmemmove.hpp>
#include <sprout/cwchar/wcscat.hpp>
#include <sprout/cwchar/wcsncat.hpp>
#include <sprout/cwchar/wmemcmp.hpp>
#include <sprout/cwchar/wcscmp.hpp>
#include <sprout/cwchar/wcscoll.hpp>
@ -21,5 +27,6 @@
#include <sprout/cwchar/wcsspn.hpp>
#include <sprout/cwchar/wcsstr.hpp>
#include <sprout/cwchar/wcslen.hpp>
#include <sprout/cwchar/wmemset.hpp>
#endif // #ifndef SPROUT_CWCHER_HPP

24
sprout/cwchar/wcscat.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_WCSCAT_HPP
#define SPROUT_CSTRING_WCSCAT_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/strcat.hpp>
namespace sprout {
// 7.24.4.3.1 The wcscat function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wcscat(wchar_t* s1, wchar_t const* s2) {
return sprout::strcat(s1, s2);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_WCSCAT_HPP

24
sprout/cwchar/wcscpy.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_WCSCPY_HPP
#define SPROUT_CSTRING_WCSCPY_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/strcpy.hpp>
namespace sprout {
// 7.24.4.2.1 The wcscpy function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wcscpy(wchar_t* s1, wchar_t const* s2) {
return sprout::strcpy(s1, s2);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_WCSCPY_HPP

24
sprout/cwchar/wcsncat.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CSTRING_WCSNCAT_HPP
#define SPROUT_CSTRING_WCSNCAT_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/strncat.hpp>
namespace sprout {
// 7.24.4.3.2 The wcsncat function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wcsncat(wchar_t* s1, wchar_t const* s2, std::size_t n) {
return sprout::strncat(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CSTRING_WCSNCAT_HPP

24
sprout/cwchar/wcsncpy.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CWCHAR_WCS_HPP
#define SPROUT_CWCHAR_WCS_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/strncpy.hpp>
namespace sprout {
// 7.24.4.2.2 The wcsncpy function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wcsncpy(wchar_t* s1, wchar_t const* s2, std::size_t n) {
return sprout::strncpy(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CWCHAR_WCS_HPP

View file

@ -8,27 +8,10 @@
#ifndef SPROUT_CWCHAR_WMEMCHR_HPP
#define SPROUT_CWCHAR_WMEMCHR_HPP
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/iterator/ptr_index_iterator.hpp>
#include <sprout/algorithm/find.hpp>
#include <sprout/cstring/memchr.hpp>
namespace sprout {
namespace detail {
inline SPROUT_CONSTEXPR wchar_t const*
wmemchr_impl(wchar_t const* found, wchar_t const* last) {
return found == last ? nullptr
: found
;
}
inline SPROUT_CONSTEXPR wchar_t*
wmemchr_impl(wchar_t* found, wchar_t* last) {
return found == last ? nullptr
: found
;
}
} // namespace detail
//
// wmemchr
//
@ -37,28 +20,12 @@ namespace sprout {
//
inline SPROUT_CONSTEXPR wchar_t const*
wmemchr(wchar_t const* s, wchar_t c, size_t n) {
return sprout::detail::wmemchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(s), sprout::ptr_index(s, n),
c
)
),
s + n
);
return sprout::detail::memchr(s, c, n);
}
inline SPROUT_CONSTEXPR wchar_t*
wmemchr(wchar_t* s, wchar_t c, size_t n) {
return sprout::detail::wmemchr_impl(
sprout::ptr_unindex(
sprout::find(
sprout::ptr_index(s), sprout::ptr_index(s, n),
c
)
),
s + n
);
return sprout::detail::memchr(s, c, n);
}
} // namespace sprout

View file

@ -8,10 +8,8 @@
#ifndef SPROUT_CWCHAR_WMEMCMP_HPP
#define SPROUT_CWCHAR_WMEMCMP_HPP
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/iterator/ptr_index_iterator.hpp>
#include <sprout/algorithm/tristate_lexicographical_compare.hpp>
#include <sprout/cstring/memcmp.hpp>
namespace sprout {
//
@ -22,10 +20,7 @@ namespace sprout {
//
inline SPROUT_CONSTEXPR int
wmemcmp(wchar_t const* s1, wchar_t const* s2, std::size_t n) {
return sprout::tristate_lexicographical_compare(
sprout::ptr_index(s1), sprout::ptr_index(s1, n),
sprout::ptr_index(s2), sprout::ptr_index(s2, n)
);
return sprout::detail::memcmp(s1, s2, n);
}
} // namespace sprout

24
sprout/cwchar/wmemcpy.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CWCHAR_WMEMCPY_HPP
#define SPROUT_CWCHAR_WMEMCPY_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/memcpy.hpp>
namespace sprout {
// 7.24.4.2.3 The wmemcpy function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wmemcpy(wchar_t* s1, wchar_t const* s2, std::size_t n) {
return sprout::detail::memcpy(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CWCHAR_WMEMCPY_HPP

View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CWCHAR_WMEMMOVE_HPP
#define SPROUT_CWCHAR_WMEMMOVE_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/memmove.hpp>
namespace sprout {
// 7.24.4.2.4 The wmemmove function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wmemmove(wchar_t* s1, wchar_t const* s2, std::size_t n) {
return sprout::detail::memmove(s1, s2, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CWCHAR_WMEMMOVE_HPP

24
sprout/cwchar/wmemset.hpp Normal file
View file

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_CWCHAR_WMEMSET_HPP
#define SPROUT_CWCHAR_WMEMSET_HPP
#include <sprout/config.hpp>
#include <sprout/cstring/memset.hpp>
namespace sprout {
// 7.24.4.6.2 The wmemset function
//
inline SPROUT_CXX14_CONSTEXPR wchar_t*
wmemset(wchar_t* s, wchar_t c, std::size_t n) {
return sprout::detail::memset(s, c, n);
}
} // namespace sprout
#endif // #ifndef SPROUT_CWCHAR_WMEMSET_HPP

View file

@ -19,7 +19,7 @@ namespace sprout {
// fft
//
template<typename RandomAccessRange>
inline SPROUT_CONSTEXPR void
inline SPROUT_CXX14_CONSTEXPR void
fft(RandomAccessRange&& rng) {
sprout::fft(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)));
}

View file

@ -19,7 +19,7 @@ namespace sprout {
// ifft
//
template<typename RandomAccessRange>
inline SPROUT_CONSTEXPR void
inline SPROUT_CXX14_CONSTEXPR void
ifft(RandomAccessRange&& rng) {
sprout::ifft(sprout::begin(SPROUT_FORWARD(RandomAccessRange, rng)), sprout::end(SPROUT_FORWARD(RandomAccessRange, rng)));
}

View file

@ -62,6 +62,7 @@
#include <sprout/range/algorithm.hpp>
#include <sprout/range/numeric.hpp>
#include <sprout/range/numeric/dft.hpp>
#include <sprout/range/numeric/fft.hpp>
#include <sprout/string.hpp>
#include <sprout/sub_array.hpp>
#include <sprout/tpp/algorithm.hpp>