次のコードを検討してください。
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)
{
}
};
使用可能なコンストラクターは、基本型へのconst参照を取得するコピーコンストラクターのみです。使用例:
std::ofstream x(std::ofstream("")); // ok
basic_ios_adaptor<std::ofstream> y(std::ofstream("")); // error
Visual C ++:
'std :: basic_ios <_Elem、_Traits> :: basic_ios':クラスで宣言されたプライベートメンバーにアクセスできません' std :: basic_ios <_Elem、_Traits> '
Intel:
コンストラクター"std:: basic_ofstream <_Elem、_Traits> :: basic_ofstream [with _Elem = char、_Traits = std::char_traits]"のインスタンスが引数リストに一致しません
なぜこれが機能しないのか誰かが私に説明できますか?