The compiler-generated copy-constructor and assigment operators would be wrong
for IconvProcessor::Impl, since cd would be copied, and iconv_close() could
thus be called twice on the same descriptor. The old code did work, but now
IconvProcessor::Impl cannot be copied by accident in the future.
static const iconv_t invalid_cd = (iconv_t)(-1);
-struct IconvProcessor::Impl
+class IconvProcessor::Impl
{
+ // noncopyable because iconv_close() is called in destructor
+ Impl(Impl const &);
+ Impl & operator=(Impl const &);
+public:
Impl(string const & to, string const & from)
: cd(invalid_cd), tocode_(to), fromcode_(from)
{}
/// \return true if the processor is ready to use.
bool init();
/// hide internals
- struct Impl;
+ class Impl;
Impl * pimpl_;
};