Monday, 26 August 2013

using parent constructor not working

using parent constructor not working

I am trying to inherit std::ostream_iterator, so I do:
template< class T,
class CharT = char,
class Traits = std::char_traits<CharT>>
class ostream_iterator : public std::ostream_iterator<T, CharT, Traits> {
using std::ostream_iterator<T, CharT, Traits>::ostream_iterator;
};
I try to inherit the constructors too (by C++11) but it still gives me error:
error: 'std::ostream_iterator<T, CharT, Traits>::ostream_iterator' names
constructor
How can I use using constructor properly? I search the internet but the
answer is exactly the same as above.

No comments:

Post a Comment