は、次のコードを考えてみてくださいそのコピーコンストラクタ呼び出し:は、テンプレート引数から派生し、
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>」
インテル:
コンストラクタ のインスタンス "のstd :: basic_ofstream < _Elem、 _Traits> :: basic_ofstream [_Elem = CHAR、_Traits = STDとは:: char_traits]" 引数リスト
と一致する誰もが説明してもらえなぜ私はこれが機能していないのですか?
ストリームのコピーとはどういう意味ですか?ストリームはコンテナではなく、データの流れです。 –
@ Yochai Timmer - それはあなたのコーディング標準ではありません。 –
@ Yochai:いいえ。大文字でクラス名を始めることはできません。大文字で始まるC++標準型を1つ指定します。 –