Files
42_INT_11_ft_containers/srcs/ftvector.cpp
2022-06-01 15:41:14 +02:00

91 lines
2.6 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ftvector.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/01 15:39:26 by simplonco #+# #+# */
/* Updated: 2022/06/01 15:39:57 by simplonco ### ########.fr */
/* */
/* ************************************************************************** */
#include "ftvector.hpp"
#define COPLIEN_COLOR B_CYAN
/*********************************************
* CONSTRUCTORS
*********************************************/
ftvector::ftvector() :
_size(0) {
// std::cout << COPLIEN_COLOR "ftvector constructor" RESET "\n";
_allocator = std::allocator<int>();
return;
}
ftvector::ftvector( ftvector const & src ) {
// std::cout << COPLIEN_COLOR "ftvector copy constructor" RESET "\n";
*this = src;
return;
}
/*********************************************
* DESTRUCTORS
*********************************************/
ftvector::~ftvector() {
// std::cout << COPLIEN_COLOR "ftvector destructor" RESET "\n";
return;
}
/*********************************************
* OPERATORS
*********************************************/
ftvector & ftvector::operator=( ftvector const & rhs ) {
// Base::operator=(rhs);
if ( this != &rhs )
{
_size = rhs.size();
}
return *this;
}
//std::ostream & operator<<(std::ostream & o, ftvector const & rhs)
//{
// o << rhs.getFoo();
// return (o);
//}
/*********************************************
* ACCESSORS
*********************************************/
unsigned int ftvector::size() const {return _size;}
/*********************************************
* PUBLIC MEMBER FUNCTIONS
*********************************************/
void ftvector::push_back(const int & element) {
_mem_ptr = _allocator.allocate(1);
_allocator.construct(_mem_ptr, element);
_size++;
}
/*********************************************
* NESTED CLASS
*********************************************/
//void ftvector::Class::function() {}
/*********************************************
* STATICS
*********************************************/
//std::string const ftvector::_bar = "bar";