Danny Robson
f6056153e3
This places, at long last, the core library code into the same namespace as the extended library code.
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* Copyright 2010-2016 Danny Robson <danny@nerdcruft.net>
|
|
*/
|
|
|
|
#ifndef __UTIL_PASCAL_HPP
|
|
#define __UTIL_PASCAL_HPP
|
|
|
|
#include <cstdlib>
|
|
#include <iosfwd>
|
|
|
|
namespace cruft {
|
|
template <typename DataT, typename SizeT = std::size_t>
|
|
class parray {
|
|
public:
|
|
parray (SizeT size, DataT *data);
|
|
|
|
DataT& operator[] (SizeT idx);
|
|
const DataT& operator[] (SizeT idx) const;
|
|
|
|
DataT& at (SizeT idx);
|
|
const DataT& at (SizeT idx) const;
|
|
|
|
DataT* begin (void);
|
|
DataT* end (void);
|
|
|
|
const DataT* cbegin (void) const;
|
|
const DataT* cend (void) const;
|
|
|
|
const DataT* data (void) const;
|
|
DataT* data (void);
|
|
SizeT size (void) const;
|
|
|
|
private:
|
|
const SizeT m_size;
|
|
DataT *m_data;
|
|
};
|
|
|
|
template <typename SizeT>
|
|
std::ostream&
|
|
operator<< (std::ostream&, cruft::parray<const char, SizeT>);
|
|
|
|
template <typename SizeT>
|
|
std::ostream&
|
|
operator<< (std::ostream&, cruft::parray<char, SizeT>);
|
|
|
|
template <typename DataT, typename SizeT>
|
|
std::ostream&
|
|
operator<< (std::ostream&, cruft::parray<DataT, SizeT>);
|
|
}
|
|
|
|
|
|
#endif
|