Пример #1
0
String::String(const String &s)
{
	auto ret = alloc_n_copy(s.begin(),s.end());
	spos = ret.first ;
	first_free = epos = ret.second ;
	cout << "executing String(String) " << endl;
}
Пример #2
0
String::String(const String& str)
{
	auto newdata = alloc_n_copy(str.begin(), str.end());
	elements = newdata.first;
	firstfree = cap = newdata.second;
	std::cout << "copy construct" << std::endl;
}
Пример #3
0
StrVec &StrVec::operator=(const StrVec &rhs) {
  auto data = alloc_n_copy(rhs.begin(), rhs.end());
  free();
  first_elem = data.first;
  first_free = cap = data.second;
  return *this;
}
Пример #4
0
String::String(const String& s)
{
    std::cout << "copy constructor used" << std::endl;
    auto data = alloc_n_copy(s.begin(), s.end());
    elements = data.first;
    first_free = data.second;
}
Пример #5
0
str_vec &str_vec::operator=(const str_vec &vc)
{
    auto p = alloc_n_copy(vc.elements,vc.first_free);
    free();
    elements = p.first;
    first_free = cap = p.second;
    return *this;
}
Пример #6
0
String& String::operator=(const String &rhs) {
    std::cout << "operator=(const String&)" << std::endl;
    auto newStr = alloc_n_copy(rhs.cStringBegin, rhs.cStringEnd);
    free();
    cStringBegin = newStr.first;
    cStringEnd = newStr.second;
    return *this;
}
Пример #7
0
String::String(const char* begin)
{
	int length = strlen(begin);
	char* end = const_cast<char*>(begin)+length+1;
	auto data = alloc_n_copy(begin, end);
	elements = data.first;
	firstfree = cap = data.second;
}
Пример #8
0
StrVec::StrVec(const StrVec& orig) 
{	
	// call alloc_n_copy to allocate space and copy data
	auto newData = alloc_n_copy(orig.begin(), orig.end());
	// update pointers
	elements = newData.first;
	first_free = cap = newData.second;
}
Пример #9
0
String& String::operator = (const String &rhs)
{
	auto newstr = alloc_n_copy(rhs.elements, rhs.end);
	free();
	elements = newstr.first;
	end = newstr.second;
	return *this;
}
Пример #10
0
StrVec & StrVec::operator=(const StrVec &sv)
{
	free();
	auto ret = alloc_n_copy(sv.begin(),sv.end());
	elements = ret.first;
        first_free = cap =ret.second ;
	return *this;       
}
Пример #11
0
String & String::operator= (const String &s)
{
	free();
	auto ret = alloc_n_copy(s.begin(),s.end());
	spos = ret.first ;
	first_free = epos = ret.second ;
	cout << "executing operator = " << endl ;
	return *this;
}
String& String::operator=(const String& rhs)
{
	auto newstr = alloc_n_copy(rhs.elements, rhs.end);
	free();
	elements = newstr.first;
	end = newstr.second;
	std::cout << "copy-assignment" << std::endl;
	return *this;
}
Пример #13
0
String& String::operator=(String& str)
{
	auto newdata = alloc_n_copy(str.begin(), str.end());
	free();
	elements = newdata.first;
	firstfree = cap = newdata.second;
	std::cout << "Operator=" << std::endl;
	return *this;
}
Пример #14
0
String& String:: operator=(const String& rhs)
{
    std::cout << "copy assignment operator used" << std::endl;
    auto data = alloc_n_copy(rhs.begin(), rhs.end());
    free();
    elements = data.first;
    first_free = data.second;
    return *this;
}
Пример #15
0
StrVec& StrVec::operator=(const StrVec& rhs) 
{
	// call alloc_n_copy to allocate space and copy data
	auto newData = alloc_n_copy(rhs.begin(), rhs.end());
	// first, free the old memory
	free();
	//update pointers
	elements = newData.first;
	first_free = cap = newData.second;
	return *this;
}
//! copy constructor
StrVec::StrVec(const StrVec &s)
{
	/**
	* @brief newData is a pair of pointers pointing to newly allocated and copied
	*                  range : [b, e)
	*/
	std::pair<std::string*, std::string*>
		newData = alloc_n_copy(s.begin(), s.end());

	element = newData.first;
	first_free = cap = newData.second;
}
//! operator =
StrVec&
StrVec::operator =(const StrVec& rhs)
{
	//! allocate and copy first to protect against self-assignment
	std::pair<std::string*, std::string*>
		newData = alloc_n_copy(rhs.begin(), rhs.end());

	//! destroy and deallocate
	free();

	element = newData.first;
	first_free = cap = newData.second;

	return *this;
}
Пример #18
0
String::String(const char *s)
{
	auto ret = alloc_n_copy(s,s + strlen(s));	
	spos = ret.first ;
	first_free = epos = ret.second ;
}
void String::range_initializer(const char* first, const char* last)
{
	auto newstr = alloc_n_copy(first, last);
	elements = newstr.first;
	end = newstr.second;
}
Пример #20
0
StrVec::StrVec(const StrVec &rhs) {
  auto data = alloc_n_copy(rhs.begin(), rhs.end());
  first_elem = data.first;
  first_free = cap = data.second;
}
Пример #21
0
StrVec::StrVec(const StrVec &rhs)
{
    auto newdata = alloc_n_copy(rhs.begin(), rhs.end());
    elements = newdata.first;
    first_free = cap = newdata.second;
}
Пример #22
0
StrVec::StrVec(const initializer_list<string> il)
{
    auto newData = alloc_n_copy(il.begin(), il.end());
    elements = newData.first;
    first_free = cap = newData.second;
}
Пример #23
0
str_vec::str_vec(const std::initializer_list<std::string> &s)
{
    auto r = alloc_n_copy((std::string *)s.begin(),(std::string *)s.end());
    elements = r.first;
    cap = first_free = r.second;
}
Пример #24
0
str_vec::str_vec(const str_vec &vc)
{
    auto p = alloc_n_copy(vc.elements,vc.first_free);
    elements = p.first;
    cap = first_free = p.second;
}
Пример #25
0
StrVec::StrVec(initializer_list<string> s)
{
	auto ret = alloc_n_copy(s.begin(),s.end());
	elements = ret.first ;
	first_free = cap = ret.second ;
}
Пример #26
0
StrVec::StrVec(const StrVec &sv)
{
	auto ret = alloc_n_copy(sv.begin(),sv.end());
	elements = ret.first;
	first_free = cap = ret.second;
}
Пример #27
0
void StrVec::range_initialize(const std::string* first, const std::string* last)
{
    auto newdata = alloc_n_copy(first, last);
    elements = newdata.first;
    first_free = cap = newdata.second;
}
Пример #28
0
void String::range_initializer(const char *begin, const char *end) {
    auto newStr = alloc_n_copy(begin, end);
    cStringBegin = newStr.first;
    cStringEnd = newStr.second;
}