簡単にするために、このクラスStringStream
をNotifications.h
ファイルに書きました。
namespace A {
namespace B {
namespace C {
extern std::locale g_classicLocale;
class StringStream : public virtual std::ostringstream
{
public:
StringStream() { imbue(g_classicLocale); }
virtual ~StringStream() {};
};
} // namespace C
} // namespace B
} // namespace A
今、私はStringStream
自分のDBNotification.cpp
ファイルで使用しようとしています:
#include "Notifications.h"
namespace A{
namespace B{
namespace C{
DBNotification::DBNotification(){
}
DBNotification::~DBNotification(){
}
StringStream DBNotification::getValues(){
// do some work and return me a StringStream Object
}
} // C
} // B
} // A
ソースコードをビルドすると、次のようになります。
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h: In copy constructor 'std::basic_ios<char, std::char_traits<char> >::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:779: error: 'std::ios_base::ios_base(const std::ios_base&)' is private
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:55: error: within this context
../Notifications.h: In copy constructor 'A::B::C::StringStream::StringStream(const A::B::C::StringStream&)':
../Notifications.h:49: note: synthesized method 'std::basic_ios<char, std::char_traits<char> >::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)' first required here
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf: In copy constructor 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::basic_stringbuf(const std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >&)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf:781: error: 'std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits = std::char_traits<char>]' is private
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:71: error: within this context
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: In copy constructor 'std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(const std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >&)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:79: note: synthesized method 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::basic_stringbuf(const std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >&)' first required here
誰かが私に何が起こっているのか教えてもらえますか?