X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fcml%2Fcore%2Ffixed_1D.h;fp=src%2Fcml%2Fcore%2Ffixed_1D.h;h=0000000000000000000000000000000000000000;hp=eb691af1a10d01c99b6e26b282fbe149862cb7ba;hb=c2321281bf12a7efaedde930422c7ddbc92080d4;hpb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724 diff --git a/src/cml/core/fixed_1D.h b/src/cml/core/fixed_1D.h deleted file mode 100644 index eb691af..0000000 --- a/src/cml/core/fixed_1D.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- C++ -*- ------------------------------------------------------------ - -Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/ - -The Configurable Math Library (CML) is distributed under the terms of the -Boost Software License, v1.0 (see cml/LICENSE for details). - - *-----------------------------------------------------------------------*/ -/** @file - * @brief - */ - -#ifndef fixed_1D_h -#define fixed_1D_h - -#include -#include -#include -#include - -namespace cml { - -/** Statically-allocated array. - * - * @note This class is designed to have the same size as a C array with the - * same length. It's therefore possible (but not recommended!) to coerce - * a normal C array into a fixed_1D<> like this: - * - * typedef fixed_1D array; - * double c_array[10]; - * array& array_object = *((array*)&c_array); - * double e1 = array_object[1]; - * - * It's also possible to do this with a pointer to an array of values (e.g. a - * double*), whether or not it was actually declared as a fixed C array. This - * is HIGHLY DISCOURAGED, though. It's relatively straightforward to implement - * a separate class to take a C array (or pointer) and turn it into an array - * object. - * - * @sa cml::fixed - * - * @internal Do not add the empty constructor and destructor; at - * least one compiler (Intel C++ 9.0) fails to optimize them away, and they - * aren't needed anyway here. - */ -template -class fixed_1D -{ - public: - - /* Require Size > 0: */ - CML_STATIC_REQUIRE(Size > 0); - - /* Record the generator: */ - typedef fixed generator_type; - - /* Standard: */ - typedef Element value_type; - typedef Element* pointer; - typedef Element& reference; - typedef const Element& const_reference; - typedef const Element* const_pointer; - - /* Array implementation: */ - typedef value_type array_impl[Size]; - - /* For matching by memory type: */ - typedef fixed_memory_tag memory_tag; - - /* For matching by size type: */ - typedef fixed_size_tag size_tag; - - /* For matching by resizability: */ - typedef not_resizable_tag resizing_tag; - - /* For matching by dimensions: */ - typedef oned_tag dimension_tag; - - - public: - - /** The length as an enumerated value. */ - enum { array_size = Size }; - - - public: - - /** Return the number of elements in the array. */ - size_t size() const { return size_t(array_size); } - - /** Access to the data as a C array. - * - * @param i a size_t index into the array. - * @return a mutable reference to the array value at i. - * - * @note This function does not range-check the argument. - */ - reference operator[](size_t i) { return m_data[i]; } - - /** Const access to the data as a C array. - * - * @param i a size_t index into the array. - * @return a const reference to the array value at i. - * - * @note This function does not range-check the argument. - */ - const_reference operator[](size_t i) const { return m_data[i]; } - - /** Return access to the data as a raw pointer. */ - pointer data() { return &m_data[0]; } - - /** Return access to the data as a raw pointer. */ - const_pointer data() const { return &m_data[0]; } - - protected: - - fixed_1D() {} - - - protected: - - array_impl m_data; -}; - -} // namespace cml - -#endif - -// ------------------------------------------------------------------------- -// vim:ft=cpp