30 #ifndef ALLOCATED_STRING_HXX
31 #define ALLOCATED_STRING_HXX
43 template<
typename T=
char>
65 :value(src.
Steal()) {}
80 auto p =
new value_type[1];
88 const_pointer_type end) {
89 auto p =
new value_type[end - begin + 1];
90 *std::copy(begin, end, p) =
SENTINEL;
96 auto p =
new value_type[length + 1];
97 *std::copy_n(begin, length, p) =
SENTINEL;
102 std::swap(value, src.value);
107 return value ==
nullptr;
111 return value !=
nullptr;
115 return value ==
nullptr;
118 constexpr const_pointer_type
c_str()
const {
135 pointer_type result = value;
AllocatedString Clone() const
constexpr bool operator==(std::nullptr_t) const
reference_type operator[](size_type i)
static constexpr value_type SENTINEL
constexpr bool IsNull() const
static AllocatedString Empty()
StringPointer< T >::value_type value_type
static AllocatedString Donate(pointer_type value)
StringPointer< T >::const_pointer_type const_pointer_type
static AllocatedString Null()
constexpr bool operator!=(std::nullptr_t) const
static AllocatedString Duplicate(const_pointer_type src)
A string pointer whose memory is managed by this class.
const T * const_pointer_type
AllocatedString & operator=(AllocatedString &&src)
static AllocatedString Duplicate(const_pointer_type begin, const_pointer_type end)
AllocatedString(AllocatedString &&src)
const reference_type operator[](size_type i) const
AllocatedString(std::nullptr_t n)
StringPointer< T >::pointer_type pointer_type
const T & const_reference_type
constexpr const_pointer_type c_str() const
StringPointer< T >::const_reference_type const_reference_type
static AllocatedString Duplicate(const_pointer_type begin, size_type length)
StringPointer< T >::reference_type reference_type