idep_namearray.h File Reference

#include <iosfwd>

Go to the source code of this file.

Classes

class  idep_NameArray

Functions

std::ostream & operator<< (std::ostream &out, const idep_NameArray &array)

Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const idep_NameArray array 
)

Definition at line 65 of file idep_namea.cxx.

References idep_NameArray::length().

00066 {
00067     int fieldWidth = 10;
00068     int maxIndex = array.length() - 1;
00069     assert (sizeof (long int) >= 4);
00070     long int x = 1000 * 1000 * 1000;    // requires 4-byte integer.
00071     while (fieldWidth > 1 && 0 == maxIndex / x) {
00072         --fieldWidth;  
00073         x /= 10;
00074     }
00075 
00076     for (int i = 0; i < array.length(); ++i) {
00077         out.width(fieldWidth);
00078         out << i << ". " << array[i] << std::endl;
00079     }
00080 
00081     return out;
00082 }


Generated on 3 Oct 2018 for loon by  doxygen 1.6.1