2016-10-23 13:27:00 +00:00
|
|
|
#pragma once
|
2016-10-26 14:37:18 +00:00
|
|
|
#include <cstring>
|
2016-10-23 13:27:00 +00:00
|
|
|
#include "String.h"
|
|
|
|
class String;
|
|
|
|
class StringValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-23 13:41:32 +00:00
|
|
|
/* 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 */
|
2016-10-23 13:27:00 +00:00
|
|
|
class Char
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
size_t _index;
|
|
|
|
String& _string;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-10-23 16:00:22 +00:00
|
|
|
explicit Char(size_t index, String& string) :_index(index), _string(string) {}
|
2016-10-23 13:27:00 +00:00
|
|
|
operator char() const;
|
|
|
|
Char& operator=(char other);
|
|
|
|
};
|