std::codecvt<InternT,ExternT,State>::length,do_length (3) - Linux Manuals
std::codecvt<InternT,ExternT,State>::length,do_length: std::codecvt<InternT,ExternT,State>::length,do_length
NAME
std::codecvt<InternT,ExternT,State>::length,do_length - std::codecvt<InternT,ExternT,State>::length,do_length
Synopsis
Defined in header <locale>
public:
int length( StateT& state,
const ExternT* from, (1)
const ExternT* from_end,
std::size_t max ) const;
protected:
virtual int do_length( StateT& state,
const ExternT* from, (2)
const ExternT* from_end,
std::size_t max ) const;
1) public member function, calls the member function do_length of the most derived class.
2) attempts to convert the externT characters from the character array defined by [from, from_end), given initial conversion state state, to at most max internT characters, and returns the number of externT characters that such conversion would consume. Modifies state as if by executing do_in(state, from, from_end, from, to, to+max, to) for some imaginary [to, to+max) output buffer.
Return value
The number of externT characters that would be consumed if converted by do_in() until either all from_end-from characters were consumed or max internT characters were produced, or a conversion error occurred.
The non-converting specialization std::codecvt<char, char, std::mbstate_t> returns std::min(max, from_end-from)
Example
// Run this code
Output:
See also
do_in converts a string from externT to internT, such as when reading from file
[virtual]