lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Nullterminated character half-range class that may be IMPLICITLY constructed from arbitrary string classes. May be used in parameter lists, not recommended elsewhere. More...
#include <nullterminated.h>
Public Types | |
typedef strip_const< Char >::type | value_type |
Type of the characters referenced by this range. | |
typedef size_t | size_type |
Type of the size returned by this range. | |
typedef ptrdiff_t | difference_type |
Type of the difference between the addresses of two elements in this range. | |
typedef value_type * | pointer |
Type of pointers to the elements contained by this range. | |
typedef const value_type * | const_pointer |
Type of constant pointers to the elements contained by this range. | |
typedef value_type & | reference |
Type of references to the elements contained by this range. | |
typedef const value_type & | const_reference |
Type of constant references to the elements contained by this range. | |
typedef pointer | iterator |
Type of iterators to the elements contained by this range. | |
typedef const_pointer | const_iterator |
Type of constant iterators to the elements contained by this range. | |
typedef Traits | traits_type |
Character traits used by this range. | |
Public Member Functions | |
LEAN_INLINE | nullterminated_implicit (const_pointer begin) |
Constructs a (half) character range from the given C string. | |
template<class Compatible > | |
LEAN_INLINE | nullterminated_implicit (const Compatible &from, typename enable_if< is_nullterminated_compatible< Compatible, value_type, traits_type >::value, const void * >::type=nullptr) |
Constructs a (half) 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(n). | |
LEAN_INLINE size_type | size () const |
Gets the length of this character range, in characters (same as length()). O(n). | |
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_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 const_iterator | end () const |
Returns a constant iterator the last element contained by this character range. O(n). | |
LEAN_INLINE void | swap (nullterminated_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. | |
Protected Attributes | |
const_pointer | m_begin |
Nullterminated character half-range class that may be IMPLICITLY constructed from arbitrary string classes. May be used in parameter lists, not recommended elsewhere.