template<typename TStringSource, typename TChar>
struct alib::characters::ArrayTraits< TStringSource, TChar >
This type provides type-traits for character arrays. Specializations of this struct for a custom type TStringSource, 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
-
TStringSource | 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. |
Definition at line 62 of file chartraits.inl.
template<typename TStringSource, typename TChar>
In specialized versions, this method has to be provided in case that field Access is not equal to Policy::NONE. In addition to this static method, sibling method Length has to be provided.
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 Policy::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TStringSource&
, hence must not be const
.
- Parameters
-
src | The source object of external type TStringSource. |
- Returns
- Specializations have to return a pointer to the start of the character array represented by the given object src of type TStringSource.
template<typename TStringSource, typename TChar>
In specialized versions, this method has to be provided in case that field Construction is not equal to Policy::NONE.
If so, this method needs to construct and return an instance of type TStringSource, 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 TStringSource.
template<typename TStringSource, typename TChar>
In specialized versions, this method has to be provided in case that field Access is not equal to Policy::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 Policy::MutableOnly, the signature of this method needs to be slightly different with the specialization: argument src in this case must be of type TStringSource&
, hence must not be const
.
- Parameters
-
src | The source object of external type TStringSource. |
- Returns
- Specializations have to return the length of the character array represented by the given object src of type TStringSource.