23 lines
465 B
C++
23 lines
465 B
C++
#pragma once
|
|
#include <cstring>
|
|
#include "String.h"
|
|
class String;
|
|
class StringValue;
|
|
|
|
|
|
|
|
/* This class provides a simple wrapper for a char primitive, and implements
|
|
* copy-on-write semantics for the non-const String::operator[] via some magic */
|
|
class Char
|
|
{
|
|
private:
|
|
|
|
size_t _index;
|
|
String& _string;
|
|
|
|
public:
|
|
|
|
explicit Char(size_t index, String& string) :_index(index), _string(string) {}
|
|
operator char() const;
|
|
Char& operator=(char other);
|
|
}; |