T
Taras_96
Hi all,
I've come across the following code:
<snip>
We can generalize even further. We haven't seen the constructor for
basic_streambuf yet:
template <class charT, class traits = ios_char_traits<charT> >
class basic_streambuf {
traits traits_; // member data
...
public:
basic_streambuf(const traits& b = traits())
: traits_(b) { ... }
int_type eof() { return traits_.eof(); }
};
By adding a default constructor parameter, we can use a traits
template parameter that may vary not only at compile time, but at
runtime
</snip>
What does this code allow you to do? How does it let you change a
traits parameter that varies at runtime?
I've come across the following code:
<snip>
We can generalize even further. We haven't seen the constructor for
basic_streambuf yet:
template <class charT, class traits = ios_char_traits<charT> >
class basic_streambuf {
traits traits_; // member data
...
public:
basic_streambuf(const traits& b = traits())
: traits_(b) { ... }
int_type eof() { return traits_.eof(); }
};
By adding a default constructor parameter, we can use a traits
template parameter that may vary not only at compile time, but at
runtime
</snip>
What does this code allow you to do? How does it let you change a
traits parameter that varies at runtime?