Question

Please consider the following code:

template<class basic_ios_type>
class basic_ios_adaptor;

template<template<typename, class> class basic_ios_type, typename char_type, class traits_type>
class basic_ios_adaptor<basic_ios_type<char_type, traits_type>>
    : public basic_ios_type<char_type, traits_type>
{
public:
    typedef basic_ios_type<char_type, traits_type> base_type;

    basic_ios_adaptor(base_type const& other)
        : base_type(other)
    {
    }
};

The only available constructor is a copy constructor which takes a const reference to the base type. Example usage:

std::ofstream                    x(std::ofstream(""));  // ok
basic_ios_adaptor<std::ofstream> y(std::ofstream(""));  // error

Visual C++:

'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'

Intel:

no instance of constructor "std::basic_ofstream<_Elem, _Traits>::basic_ofstream [with _Elem=char, _Traits=std::char_traits]" matches the argument list

Could anybody explain to me why this isn't working?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top