File tree Expand file tree Collapse file tree 1 file changed +51
-3
lines changed
data-structures/Array/include Expand file tree Collapse file tree 1 file changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,62 @@ class String{
4848 Vector<char > _data;
4949};
5050
51-
5251// Constructor and Desttructor
53- String::String (){
52+ String::String () : _data() {}
53+
54+ String::~String (){
5455
5556}
5657
57- String::~String (){
58+ // Capacity
59+ bool String::empty () const {
60+ return _data.empty ();
61+ }
62+
63+ size_t String::size () const {
64+ return _data.size ();
65+ }
66+
67+ size_t String::length () const
68+ {
69+ return _data.size ();
70+ }
71+
72+ size_t String::capacity () const {
73+ return _data.capacity ();
74+ }
75+
76+ void String::reserve (const size_t n){
77+ _data.reserve (n);
78+ }
79+
80+ void String::resize (size_t n){
81+ _data.resize (n);
82+ }
83+
84+ void String::clear (){
85+ _data.clear ();
86+ }
87+
88+ void String::shrink_to_fit (){
89+ _data.shrink_to_fit ();
90+ }
91+
92+ // Elements access
93+ char & String::front (){
94+ return _data.front ();
95+ }
96+
97+ char & String::back (){
98+ return _data.back ();
99+ }
100+
101+ char & String::at (const size_t index){
102+ return _data.at (index);
103+ }
58104
105+ char & String::operator [](const size_t index){
106+ return _data[index];
59107}
60108
61109#endif // STRING_H
You can’t perform that action at this time.
0 commit comments