[C++-sig] Wrapping a class with a private copy ctor

Matthew Scouten matthew.scouten at gmail.com
Tue Sep 25 17:33:02 CEST 2007


Right, so the class that I need to wrap has a private copy ctor.  I do
not need to copy objects of this class, or pass them to and from
python.  I only need to subclass them in python. In fact I only ever
need one. But Boost::python seems to choke on the private copy ctor.
Is there a way around this?

example code:

class Base
{
	private:
	Base(const Base&);
	Base & operator=(const Base &);
}

class Derived : public Base
{

}

struct Derived_wrapper : Derived
{
}

BOOST_PYTHON_MODULE(core)
{
	class_<CTTPriceConsumer_wrapper>("CTTPriceConsumer");
}

Errors:
1>------ Build started: Project: corewrapper, Configuration: Release
Win32 ------
1>Compiling...
1>test.cpp
1>.\test.cpp(21) : error C2248: 'Base::Base' : cannot access private
member declared in class 'Base'
1>        .\test.cpp(14) : see declaration of 'Base::Base'
1>        .\test.cpp(12) : see declaration of 'Base'
1>        This diagnostic occurred in the compiler generated function
'Derived::Derived(const Derived &)'
1>Build log was saved at
"file://c:\tt-dev\corewrapper\tools\fix\main\dev\corewrapper\Release\corewrapper_Release_BuildLog.htm"
1>corewrapper - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



More information about the Cplusplus-sig mailing list