save
This commit is contained in:
parent
3afe24c9a8
commit
96e6514337
5 changed files with 23 additions and 33 deletions
|
@ -5,6 +5,9 @@
|
|||
#include <mutex>
|
||||
#include <utility>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief A thread-safe dynamic array container class
|
||||
*
|
||||
|
@ -160,6 +163,22 @@ public:
|
|||
return size_;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const List& list)
|
||||
{
|
||||
os << "[List] List( type: {" << typeid(T).name() << "}, size: " << list.size_ << ") [ ";
|
||||
for (size_t i = 0; i < list.size_ - 1; i++)
|
||||
{
|
||||
os << list[i] << ", ";
|
||||
}
|
||||
os << list[list.size_ - 1] << " ]";
|
||||
return os;
|
||||
}
|
||||
|
||||
static std::string type_name()
|
||||
{
|
||||
return "List<" + std::string(typeid(T).name()) + ">";
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<T[]> data_; ///< Underlying array storage
|
||||
std::size_t size_; ///< Number of elements in the array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue