Classes | Functions
IndexRange.h File Reference
#include <string>
#include <vector>
#include <iostream>

Go to the source code of this file.

Classes

class  IndexRange
 

Functions

std::ostream & operator<< (std::ostream &lhs, const IndexRange &ir)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  lhs,
const IndexRange ir 
)

Definition at line 114 of file IndexRange.h.

114  {
115  lhs << ir.name << ": ";
116  if ( ir.size() == 0 ) {
117  lhs << "<empty>";
118  } else if ( ir.size() == 1 ) {
119  lhs << ir.begin;
120  } else {
121  lhs << "[" << ir.begin << ", " << ir.end << ")";
122  }
123  bool first = true;
124  for ( std::string lab : ir.labels ) {
125  if ( first ) first = false;
126  else lhs << ",";
127  lhs << " " << lab;
128  }
129  return lhs;
130 }
NameVector labels
Definition: IndexRange.h:33
std::string string
Definition: nybbler.cc:12
Index begin
Definition: IndexRange.h:34
Index size() const
Definition: IndexRange.h:88
Index end
Definition: IndexRange.h:35
Name name
Definition: IndexRange.h:32