/*
    PIP - Platform Independent Primitives
    Generic containers
    Copyright (C) 2015  Ivan Pelipenko peri4ko@gmail.com

    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 <http://www.gnu.org/licenses/>.
*/

// * This class based on std::vector, expanding his functionality

/** \class PIVector
 * \brief Dynamic array of any type
 * \details This class used to store dynamic array of any
 * type of data. In memory data stored linear. You can insert
 * item in any place of remove some items from any place.
 * For quick add elements this is stream operator <<.

 * \fn PIVector::PIVector();
 * Contructs an empty vector

 * \fn PIVector::PIVector(ullong size, const Type & value = Type());
 * \brief Contructs vector with size "size" filled elements "value"
 * \details Example: \snippet picontainers.cpp PIVector::PIVector

 * \fn const Type & PIVector::at(ullong index) const;
 * \brief Read-only access to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::at_c
 * \sa \a operator[]

 * \fn Type & PIVector::at(ullong index);
 * \brief Full access to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::at
 * \sa \a operator[]

 * \fn const Type * PIVector::data(ullong index = 0) const;
 * \brief Read-only pointer to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::data_c

 * \fn Type * PIVector::data(ullong index = 0);
 * \brief Pointer to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::data

 * \fn ullong PIVector::size() const;
 * \brief Elements count

 * \fn int PIVector::size_s() const;
 * \brief Elements count

 * \fn bool PIVector::isEmpty() const;
 * \brief Return \c "true" if vector is empty, i.e. size = 0

 * \fn bool PIVector::has(const Type & t) const;

 * \fn bool PIVector::contains(const Type & v) const;
 * \brief Return \c "true" if vector has at least one element equal "t"

 * \fn int PIVector::etries(const Type & t) const;
 * \brief Return how many times element "t" appears in vector

 * \fn static int PIVector::compare_func(const Type * t0, const Type * t1);
 * \brief Standard compare function for type "Type". Return  0 if t0 = t1,  -1 if t0 < t1  and  1 if t0 > t1.

 * \fn void PIVector::resize(ullong size, const Type & new_type = Type());
 * \brief Resize vector to size "size"
 * \details Elements removed from end of vector if new size < old size, or added new elements = "new_type" if new size > old size.\n
 * Example: \snippet picontainers.cpp PIVector::resize
 * \sa \a size(), \a clear()

 * \fn PIVector<T> & PIVector::enlarge(ullong size);
 * \brief Increase vector size with "size" elements

 * \fn void PIVector::clear();
 * \brief Clear vector. Equivalent to call <tt>"resize(0)"</tt>

 * \fn PIVector<T> & PIVector::sort(CompareFunc compare = compare_func);
 * \brief Sort vector using quick sort algorithm and standard compare function
 * \details Example: \snippet picontainers.cpp PIVector::sort_0 
 * With custom compare function: \snippet picontainers.cpp PIVector::sort_1

 * \fn PIVector<T> & PIVector::fill(const Type & t);
 * \brief Fill vector with elements "t" leave size is unchanged and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::fill

 * \fn Type & PIVector::back();
 * \brief Last element of the vector

 * \fn const Type & PIVector::back() const;
 * \brief Last element of the vector

 * \fn Type & PIVector::front();
 * \brief First element of the vector

 * \fn const Type & PIVector::front() const;
 * \brief First element of the vector

 * \fn PIVector<T> & PIVector::push_back(const Type & t);
 * \brief Add new element "t" at the end of vector and return reference to vector

 * \fn PIVector<T> & PIVector::push_front(const Type & t);
 * \brief Add new element "t" at the beginning of vector and return reference to vector

 * \fn PIVector<T> & PIVector::pop_back();
 * \brief Remove one element from the end of vector and return reference to vector

 * \fn PIVector<T> & PIVector::pop_front();
 * \brief Remove one element from the beginning of vector and return reference to vector

 * \fn Type PIVector::take_back();
 * \brief Remove one element from the end of vector and return it

 * \fn Type PIVector::take_front();
 * \brief Remove one element from the beginning of vector and return it

 * \fn PIVector<T> & PIVector::remove(uint index);
 * \brief Remove one element by index "index" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::remove_0
 * \sa \a removeOne(), \a removeAll()

 * \fn PIVector<T> & PIVector::remove(uint index, uint count);
 * \brief Remove "count" elements by first index "index" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::remove_1
 * \sa \a removeOne(), \a removeAll()

 * \fn PIVector<T> & PIVector::removeOne(const Type & v);
 * \brief Remove no more than one element equal "v" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::removeOne
 * \sa \a remove(), \a removeAll()

 * \fn PIVector<T> & PIVector::removeAll(const Type & v);
 * \brief Remove all elements equal "v" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::removeAll
 * \sa \a remove(), \a removeOne()

 * \fn PIVector<T> & PIVector::insert(uint pos, const Type & t);
 * \brief Insert element "t" after index "pos" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::insert_0

 * \fn PIVector<T> & PIVector::insert(uint pos, const PIVector<T> & t);
 * \brief Insert other vector "t" after index "pos" and return reference to vector
 * \details Example: \snippet picontainers.cpp PIVector::insert_1

 * \fn Type & PIVector::operator [](uint index);
 * \brief Full access to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::()
 * \sa \a at()

 * \fn const Type & PIVector::operator [](uint index) const;
 * \brief Read-only access to element by index "index"
 * \details Example: \snippet picontainers.cpp PIVector::()_c
 * \sa \a at()

 * \fn PIVector<T> & PIVector::operator <<(const Type & t);
 * \brief Add new element "t" at the end of vector and return reference to vector

 * \fn PIVector<T> & PIVector::operator <<(const PIVector<T> & t);
 * \brief Add vector "t" at the end of vector and return reference to vector

 * \fn bool PIVector::operator ==(const PIVector<T> & t);
 * \brief Compare with vector "t"

 * \fn bool PIVector::operator !=(const PIVector<T> & t);
 * \brief Compare with vector "t"

 * */
