/*
* This file is part of libgim.
*
* libgim 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.
*
* libgim 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 libgim. If not, see .
*
* Copyright 2010 Danny Robson
*/
#include "pascal.hpp"
#include
using util::parray;
//-----------------------------------------------------------------------------
template
parray::parray (size_t _size, T *_data):
size (_size),
data (_data)
{ ; }
//-----------------------------------------------------------------------------
template
T&
parray::operator[] (size_t idx) {
return data[idx];
}
template
const T&
parray::operator[] (size_t idx) const {
return data[idx];
}
//-----------------------------------------------------------------------------
template
T&
parray::at (size_t idx) {
if (idx >= size)
throw std::out_of_range ("invalid index for parray");
return (*this)[idx];
}
template
const T&
parray::at (size_t idx) const {
if (idx >= size)
throw std::out_of_range ("invalid index for parray");
return (*this)[idx];
}
//-----------------------------------------------------------------------------
template
T*
parray::begin (void) const {
return data;
}
template
T*
parray::end (void) const {
return data + size;
}
//-----------------------------------------------------------------------------
template
const T*
parray::cbegin (void) const {
return data;
}
template
const T*
parray::cend (void) const {
return data + size;
}
//-----------------------------------------------------------------------------
template
std::ostream&
util::operator<< (std::ostream &os, parray p) {
os << "[" << p.size << ", " << std::hex << p.data << std::dec << "]";
return os;
}
template std::ostream& util::operator<< (std::ostream&, parray);
template std::ostream& util::operator<< (std::ostream&, parray);
template std::ostream& util::operator<< (std::ostream&, parray);
template std::ostream& util::operator<< (std::ostream&, parray);
template std::ostream& util::operator<< (std::ostream&, parray);
template std::ostream& util::operator<< (std::ostream&, parray);
//-----------------------------------------------------------------------------
namespace util {
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
template struct parray;
}