lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Nullterminated character range class that may be constructed IMPLICITLY from arbitrary string classes. May be used in parameter lists, not recommended elsewhere. More...
#include <nullterminated_range.h>
Public Types | |
typedef base_type::value_type | value_type |
Type of the characters referenced by this range. | |
typedef base_type::size_type | size_type |
Type of the size returned by this range. | |
typedef base_type::difference_type | difference_type |
Type of the difference between the addresses of two elements in this range. | |
typedef base_type::pointer | pointer |
Type of pointers to the elements contained by this range. | |
typedef base_type::const_pointer | const_pointer |
Type of constant pointers to the elements contained by this range. | |
typedef base_type::reference | reference |
Type of references to the elements contained by this range. | |
typedef base_type::const_reference | const_reference |
Type of constant references to the elements contained by this range. | |
typedef base_type::pointer | iterator |
Type of iterators to the elements contained by this range. | |
typedef base_type::const_iterator | const_iterator |
Type of constant iterators to the elements contained by this range. | |
typedef base_type::traits_type | traits_type |
Character traits used by this range. | |
Public Member Functions | |
LEAN_INLINE | nullterminated_range_implicit (const nullterminated_implicit< Char, Traits > &right) |
Constructs a character range from the given half-range. | |
LEAN_INLINE | nullterminated_range_implicit (const_pointer begin) |
Constructs a character range from the given C string. | |
LEAN_INLINE | nullterminated_range_implicit (const_pointer begin, const_pointer end) |
Constructs a character range from the given C string range (*end must be null character). | |
template<class Compatible > | |
LEAN_INLINE | nullterminated_range_implicit (const Compatible &from, typename enable_if< is_nullterminated_compatible< Compatible, value_type, traits_type >::value, const void * >::type=nullptr) |
Constructs a character range from the given compatible object. | |
LEAN_INLINE bool | empty () const |
Gets whether this character range is currently empty. | |
LEAN_INLINE size_type | length () const |
Gets the length of this character range, in characters (same as size()). O(1). | |
LEAN_INLINE size_type | size () const |
Gets the length of this character range, in characters (same as length()). O(1). | |
LEAN_INLINE size_type | count () const |
Gets the length of this character range, in code points (might differ from length() and size()). O(n). | |
LEAN_INLINE const_iterator | end () const |
Returns a constant iterator the last element contained by this character range. O(1). | |
LEAN_INLINE void | swap (nullterminated_range_implicit &right) |
Swaps the contents of this range with the contents of the given range. | |
template<class Compatible > | |
Compatible | to () const |
Constructs a compatible object from this null-terminated character range. | |
LEAN_INLINE const_reference | operator[] (size_type pos) const |
Gets an element by position, access violation on failure. | |
LEAN_INLINE const_pointer | c_str () const |
Gets a pointer to this nullterminated range. | |
LEAN_INLINE const_pointer | data () const |
Gets a pointer to this nullterminated range. | |
LEAN_INLINE const_iterator | begin () const |
Returns a constant iterator to the first element contained by this character range. O(1). | |
LEAN_INLINE void | swap (nullterminated_implicit &right) |
Swaps the contents of this range with the contents of the given range. | |
Protected Attributes | |
const_pointer | m_end |
const_pointer | m_begin |
Nullterminated character range class that may be constructed IMPLICITLY from arbitrary string classes. May be used in parameter lists, not recommended elsewhere.