template<typename TString, typename TChar, typename TEnableIf = void>
struct alib::characters::T_CharArray< TString, TChar, TEnableIf >
This type provides type traits for character arrays. Specializations of this struct for a custom type TString, expose information about that type representing a character array and how the array data may be accessed.
In addition, information about how the type may be constructed from character array data may be provided with specializations of this type.
- See also
- For detailed information, see chapter 4. Character Arrays of the Programmer's Manual of module ALib Characters.
- Template Parameters
-
TString | The type for which specializations of this struct provide array type traits. |
TChar | The character type of the character array that specializations provide type traits for. |
TEnableIf | Optional TMP parameter to allow templated and/or selective specializations. |
Definition at line 253 of file chartraits.hpp.
template<typename TString , typename TChar , typename TEnableIf = void>
static const TChar * Buffer |
( |
const TString & | src | ) |
|
|
static |
In specialized versions, this method has to be provided in case that field Access is not equal to AccessType::NONE. In addition to this static method, sibling method Length has to be provoided.
For example, in a specialization for standard C++ class std::string
, this method returns the result of method std::string::data()
.
Note, that in the case of access type AccessType::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TString&
, hence must not be const
.
- Parameters
-
src | The source object of external type TString. |
- Returns
- Specializations have to return a pointer to the start of the character array represented by the given object src of type TString.
template<typename TString , typename TChar , typename TEnableIf = void>
static TString Construct |
( |
const TChar * | array, |
|
|
integer | length ) |
|
static |
In specialized versions, this method has to be provided in case that field Construction is not equal to ConstructionType::NONE.
If so, this method needs to construct and return an instance of type TString, created from the character array specified by arguments array and length
- Parameters
-
array | The external array to be used to create the return value. |
length | The length of the external array. |
- Returns
- A new instance (value) of type TString.
template<typename TString , typename TChar , typename TEnableIf = void>
static integer Length |
( |
const TString & | src | ) |
|
|
static |
In specialized versions, this method has to be provided in case that field Access is not equal to AccessType::NONE. In addition to this static method, sibling method Buffer has to be provoided.
For example, in a specialization for standard C++ class std::string
, this method returns the result of method std::string::size()
.
Note, that in the case of access type AccessType::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TString&
, hence must not be const
.
- Parameters
-
src | The source object of external type TString. |
- Returns
- Specializations have to return the length of the character array represented by the given object src of type TString.