feat(string): add CTStringView and CTString concepts
This commit is contained in:
parent
6230ec9df6
commit
19a37ea072
@ -18,6 +18,9 @@ NAMESPACE_MODULE_BEGIN(Utility)
|
|||||||
|
|
||||||
NAMESPACE_PRIVATE_BEGIN
|
NAMESPACE_PRIVATE_BEGIN
|
||||||
|
|
||||||
|
template <typename T > struct TIsTString : FFalse { };
|
||||||
|
template <typename T, typename A> struct TIsTString<TString<T, A>> : FTrue { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class TCStringFromTString final : FNoncopyable
|
class TCStringFromTString final : FNoncopyable
|
||||||
{
|
{
|
||||||
@ -58,6 +61,8 @@ private:
|
|||||||
|
|
||||||
NAMESPACE_PRIVATE_END
|
NAMESPACE_PRIVATE_END
|
||||||
|
|
||||||
|
template <typename T> concept CTString = NAMESPACE_PRIVATE::TIsTString<TRemoveCV<T>>::Value;
|
||||||
|
|
||||||
/** The default string allocator that uses SSO and can be placed right into FAny without dynamically allocating memory. */
|
/** The default string allocator that uses SSO and can be placed right into FAny without dynamically allocating memory. */
|
||||||
template <CCharType T>
|
template <CCharType T>
|
||||||
using TDefaultStringAllocator = TInlineAllocator<(40 - 3 * sizeof(size_t)) / sizeof(T)>;
|
using TDefaultStringAllocator = TInlineAllocator<(40 - 3 * sizeof(size_t)) / sizeof(T)>;
|
||||||
|
@ -20,9 +20,21 @@ NAMESPACE_REDCRAFT_BEGIN
|
|||||||
NAMESPACE_MODULE_BEGIN(Redcraft)
|
NAMESPACE_MODULE_BEGIN(Redcraft)
|
||||||
NAMESPACE_MODULE_BEGIN(Utility)
|
NAMESPACE_MODULE_BEGIN(Utility)
|
||||||
|
|
||||||
|
template <CCharType T>
|
||||||
|
class TStringView;
|
||||||
|
|
||||||
template <CCharType T, CAllocator<T> Allocator>
|
template <CCharType T, CAllocator<T> Allocator>
|
||||||
class TString;
|
class TString;
|
||||||
|
|
||||||
|
NAMESPACE_PRIVATE_BEGIN
|
||||||
|
|
||||||
|
template <typename T> struct TIsTStringView : FFalse { };
|
||||||
|
template <typename T> struct TIsTStringView<TStringView<T>> : FTrue { };
|
||||||
|
|
||||||
|
NAMESPACE_PRIVATE_END
|
||||||
|
|
||||||
|
template <typename T> concept CTStringView = NAMESPACE_PRIVATE::TIsTStringView<TRemoveCV<T>>::Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class template TStringView describes an object that can refer to a constant contiguous sequence of char-like objects
|
* The class template TStringView describes an object that can refer to a constant contiguous sequence of char-like objects
|
||||||
* with the first element of the sequence at position zero. Provides a set of convenient string processing functions.
|
* with the first element of the sequence at position zero. Provides a set of convenient string processing functions.
|
||||||
@ -506,8 +518,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Converts a string into a boolean value.
|
* Converts a string into a boolean value.
|
||||||
*
|
*
|
||||||
* - 1, "true", "True", "TRUE" and non-zero integers become true.
|
* - "True" and non-zero integers become true.
|
||||||
* - 0, "false", "False", "FALSE" and unparsable values become false.
|
* - "False" and unparsable values become false.
|
||||||
*
|
*
|
||||||
* @return The boolean value.
|
* @return The boolean value.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user