#include "ct_cloud/ct_standardcloudstdvectort.h" template CT_StandardCloudStdVectorT::CT_StandardCloudStdVectorT(size_t size) : CT_AbstractCloudT() { if(size > 0) m_collection.resize(size); } template typename CT_StandardCloudStdVectorT::Iterator CT_StandardCloudStdVectorT::begin() { return m_collection.begin(); } template typename CT_StandardCloudStdVectorT::Const_Iterator CT_StandardCloudStdVectorT::constBegin() const { return m_collection.begin(); } template typename CT_StandardCloudStdVectorT::Iterator CT_StandardCloudStdVectorT::end() { return m_collection.end(); } template typename CT_StandardCloudStdVectorT::Const_Iterator CT_StandardCloudStdVectorT::constEnd() const { return m_collection.end(); } template size_t CT_StandardCloudStdVectorT::size() const { return m_collection.size(); } template size_t CT_StandardCloudStdVectorT::memoryUsed() const { return size() * sizeof(T); } template T& CT_StandardCloudStdVectorT::operator[](const size_t &index) { return pTAt(index); } template const T& CT_StandardCloudStdVectorT::operator[](const size_t &index) const { return pTAt(index); } template void CT_StandardCloudStdVectorT::erase(const size_t &beginIndex, const size_t &sizes) { if(sizes == 0) return; const size_t endIndex = std::min(beginIndex + sizes, size()); const size_t cpySize = size() - endIndex; if(cpySize > 0) { T *data = m_collection.data(); T *dst = data+beginIndex; T *src = data+endIndex; #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif memcpy(dst, src, sizeof(T)*cpySize); #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic pop #endif } resize(size() - std::min(sizes, size())); } template void CT_StandardCloudStdVectorT::resize(const size_t &newSize) { m_collection.resize(newSize, T()); m_collection.shrink_to_fit(); } template void CT_StandardCloudStdVectorT::reserve(const size_t &newSize) { m_collection.reserve(newSize); } template void CT_StandardCloudStdVectorT::internalCopyData(const size_t &destIndex, const size_t &srcIndex, const size_t &size) { T *data = &pTAt(0); T *dst = data+destIndex; T *src = data+srcIndex; #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif memcpy(dst, src, sizeof(T)*size); #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic pop #endif } template void CT_StandardCloudStdVectorT::copyDataFromTo(T* src, const size_t &destIndex, const size_t &size) { T *data = &pTAt(0); T *dst = data+destIndex; #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif memcpy(dst, src, sizeof(T)*size); #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ >= 8) #pragma GCC diagnostic pop #endif } template CT_AbstractCloud* CT_StandardCloudStdVectorT::copy() const { size_t s = size(); CT_StandardCloudStdVectorT *cloud = new CT_StandardCloudStdVectorT(s); for(size_t i=0; i void CT_StandardCloudStdVectorT::addT(const T &val) { m_collection.push_back(val); } template T& CT_StandardCloudStdVectorT::addT() { T tmp; addT(tmp); return *(m_collection.end()-1); } template void CT_StandardCloudStdVectorT::replaceT(const size_t &index, T &newVal) { m_collection[index] = newVal; }