-
Notifications
You must be signed in to change notification settings - Fork 0
/
StrBlob.h
44 lines (33 loc) · 885 Bytes
/
StrBlob.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef STRBLOB_H
#define STRBLOB_H
#include <vector>
#include <string>
#include <initializer_list>
#include <memory>
#include <stdexcept>
class StrBlobPtr;
class ConstStrBlobPtr;
class StrBlob {
friend class StrBlobPtr;
friend class ConstStrBlobPtr;
public:
typedef std::vector<std::string>::size_type size_type;
StrBlob();
StrBlob(std::initializer_list<std::string>);
size_type size() const { return data->size(); }
bool empty() const { return data->empty(); }
void push_back(const std::string &s) { data->push_back(s); }
void pop_back();
std::string &front();
std::string &back();
StrBlobPtr begin();
StrBlobPtr end();
ConstStrBlobPtr cbegin() const;
ConstStrBlobPtr cend() const;
private:
std::shared_ptr<std::vector<std::string>> data;
void check(size_type, const std::string &) const;
};
#include "StrBlobPtr.h"
#include "ConstStrBlobPtr.h"
#endif