// Author: Marek K. /* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Dieses Programm ist Freie Software: Sie koennen es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren veroeffentlichten Version, weiter verteilen und/oder modifizieren. Dieses Programm wird in der Hoffnung bereitgestellt, dass es nuetzlich sein wird, jedoch OHNE JEDE GEWAEHR,; sogar ohne die implizite Gewaehr der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK. Siehe die GNU General Public License fuer weitere Einzelheiten. Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe . */ #include "mcontainer.hpp" template mcontainer::mcontainer() { this->ptr = this->all.allocate(255); this->siz = 255; } template mcontainer::mcontainer(size_t n) { this->ptr = this->all.allocate(n); this->siz = n; } template mcontainer::~mcontainer() { this->all.deallocate(this->ptr, this->siz); } template mcontainer::iterator::iterator(T * o) : ptr(o) { } template mcontainer::iterator::iterator(const iterator & iter) : ptr(iter.ptr) { } template T & mcontainer::iterator::operator*() const { return *this->ptr; } template typename mcontainer::iterator mcontainer::iterator::operator=(const iterator & iter) { this->ptr = iter.ptr; return *this; } template typename mcontainer::iterator mcontainer::iterator::operator++(int) { mcontainer::iterator tmp(*this); this->ptr++; return tmp; } template typename mcontainer::iterator & mcontainer::iterator::operator++() noexcept { this->ptr++; return *this; } template typename mcontainer::iterator mcontainer::iterator::operator--(int) { mcontainer::iterator tmp(this->ptr); this->ptr--; return tmp; } template typename mcontainer::iterator & mcontainer::iterator::operator--() noexcept { this->ptr--; return *this; } template bool mcontainer::iterator::operator==(const iterator & iter) const noexcept { return this->ptr == iter.ptr; } template bool mcontainer::iterator::operator!=(const iterator & iter) const noexcept { return this->ptr != iter.ptr; } template bool mcontainer::iterator::operator<(const iterator & iter) const noexcept { return this->ptr < iter.ptr; } template bool mcontainer::iterator::operator>(const iterator & iter) const noexcept { return this->ptr > iter.ptr; } template typename mcontainer::iterator mcontainer::begin() { return mcontainer::iterator(this->ptr); } template typename mcontainer::iterator mcontainer::end() { return mcontainer::iterator(this->ptr + this->siz); } template T mcontainer::operator[](size_t index) const { return this->ptr[index]; } template T & mcontainer::operator[](size_t index) { return this->ptr[index]; } template T mcontainer::at(size_t index) const { return this->ptr[index]; } template T & mcontainer::at(size_t index) { return this->ptr[index]; } template size_t mcontainer::size() const noexcept { return this->siz; } template void mcontainer::clear(T val) { for (size_t i = 0; i < this->siz; i++) this->ptr[i] = val; } template Alloc mcontainer::get_allocator() const noexcept { return this->all; } template T mcontainer::front() const { return this->ptr[0]; } template T & mcontainer::front() { return this->ptr[0]; } template T mcontainer::back() const { return this->ptr[this->siz - 1]; } template T & mcontainer::back() { return this->ptr[this->siz - 1]; }