/** ** \file ast/chunk.hxx ** \brief Implementation of ast::Chunk. */ #pragma once #include #include #include namespace ast { template Chunk::Chunk(const Location& location, Ds* decs) : ChunkInterface(location) , decs_(decs) {} template Chunk::Chunk(const Location& location) : ChunkInterface(location) {} template Chunk::~Chunk() { misc::deep_clear(*decs_); delete decs_; } template inline void Chunk::accept(Visitor& v) { v(*this); } template inline void Chunk::accept(ConstVisitor& v) const { v(*this); } template inline constexpr typename Chunk::reference Chunk::operator[](size_type pos) { return decs_->operator[](pos); } template inline constexpr typename Chunk::const_reference Chunk::operator[](size_type pos) const { return decs_->operator[](pos); } template inline typename Chunk::Ds& Chunk::decs_get() { return *decs_; } template inline const typename Chunk::Ds& Chunk::decs_get() const { return *decs_; } template inline typename Chunk::iterator Chunk::begin() { return decs_->begin(); } template inline typename Chunk::const_iterator Chunk::begin() const { return decs_->begin(); } template inline typename Chunk::iterator Chunk::end() { return decs_->end(); } template inline typename Chunk::const_iterator Chunk::end() const { return decs_->end(); } template inline constexpr bool Chunk::empty() const noexcept { return decs_->empty(); } template inline constexpr typename Chunk::iterator Chunk::erase(const_iterator pos) { return decs_->erase(pos); } template inline constexpr typename Chunk::iterator Chunk::erase(const_iterator first, const_iterator last) { return decs_->erase(first, last); } template Chunk& Chunk::push_front(D& d) { location_set(location_get() + d.location_get()); decs_->insert(decs_->begin(), &d); return *this; } template Chunk& Chunk::emplace_back(D& d) { location_set(location_get() + d.location_get()); decs_->emplace_back(&d); return *this; } } // namespace ast