|
template<class charT , class Traits > |
std::basic_ostream< charT, Traits > & | operator<< (std::basic_ostream< charT, Traits > &os, const varname &v) |
| Associates the modifier to the stream. More...
|
|
template<class charT , class Traits > |
std::vector< std::string > * | get_varname (std::basic_ostream< charT, Traits > &os) |
| Gets the variable name vector associated to the stream. More...
|
|
Stream modifier to set variable names to dimensions.
By default, all level 0 std::ostream printing functions output x0
to xn
to refer to dimensions 0 to n. By inserting this modifier into a stream, you can customize the variable name.
The information is local to the stream.
The modifier is not used for level 1 printing functions as an environment mapping dimensions to variable names is already available. Also, the modifier does not affect the behavior of print functions that take the mapping as an (optional) argument.
varname::varname |
( |
const std::vector< std::string > & |
names | ) |
|
|
inline |
Creates a modifier to associate variable names to dimensions.
names
[i] is the name to give to dimension i.
If there are not enough names, printing functions will revert to xi, xi+1... To disable variable names, simply pass an empty vector.
A reference to names
is kept by the object and will be passed to the stream by the modifier. The stream will then make a deep copy and the varname object and the original vector can be safely deleted.