From: bangerth Date: Thu, 24 Sep 2009 22:07:00 +0000 (+0000) Subject: Provide operator<< for TableIndices. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7639f3cb89e4ff24ac5070fc06675f927c4b3780;p=dealii-svn.git Provide operator<< for TableIndices. git-svn-id: https://svn.dealii.org/trunk@19531 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/table_indices.h b/deal.II/base/include/base/table_indices.h index 4670bdd6bc..46d7c928cd 100644 --- a/deal.II/base/include/base/table_indices.h +++ b/deal.II/base/include/base/table_indices.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2005, 2006 by the deal.II authors +// Copyright (C) 2005, 2006, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -17,6 +17,16 @@ #include #include +// we only need output streams, but older compilers did not provide +// them in a separate include file +#ifdef HAVE_STD_OSTREAM_HEADER +# include +#else +# include +#endif + + + DEAL_II_NAMESPACE_OPEN @@ -58,7 +68,7 @@ class TableIndicesBase * used for the SymmetricTensor class. */ void sort (); - + protected: /** * Store the indices in an array. @@ -407,7 +417,7 @@ class TableIndices<7> : public TableIndicesBase<7> template inline unsigned int -TableIndicesBase::operator [] (const unsigned int i) const +TableIndicesBase::operator [] (const unsigned int i) const { Assert (i < N, ExcIndexRange (i, 0, N)); return indices[i]; @@ -418,7 +428,7 @@ TableIndicesBase::operator [] (const unsigned int i) const template inline bool -TableIndicesBase::operator == (const TableIndicesBase &other) const +TableIndicesBase::operator == (const TableIndicesBase &other) const { for (unsigned int i=0; i::operator == (const TableIndicesBase &other) const template inline bool -TableIndicesBase::operator != (const TableIndicesBase &other) const +TableIndicesBase::operator != (const TableIndicesBase &other) const { return !(*this == other); } @@ -475,7 +485,7 @@ TableIndicesBase<3>::sort () inline -TableIndices<1>::TableIndices () +TableIndices<1>::TableIndices () { this->indices[0] = 0; } @@ -491,7 +501,7 @@ TableIndices<1>::TableIndices (const unsigned int index1) inline -TableIndices<2>::TableIndices () +TableIndices<2>::TableIndices () { this->indices[0] = this->indices[1] = 0; } @@ -509,7 +519,7 @@ TableIndices<2>::TableIndices (const unsigned int index1, inline -TableIndices<3>::TableIndices () +TableIndices<3>::TableIndices () { this->indices[0] = this->indices[1] = this->indices[2] = 0; } @@ -633,6 +643,29 @@ TableIndices<7>::TableIndices (const unsigned int index1, } +/** + * Output operator for indices; reports them in a list like this: + * [i1,i2,...]. + */ +template +std::ostream & +operator << (std::ostream &o, + const TableIndices &indices) +{ + o << '['; + for (unsigned int i=0; ibase
    +
  1. New: There is now an operator @<@< for the + TableIndices class. +
    + (WB 2009/09/24) +

  2. +
  3. Fixed: If anything had been put into a LogStream object without flushing