the struct class class that was generated by slice2cpp does not support copy construct and operator =,
maybe it too simple, but is important to me, because it's ISO standard.
sample:
slice:
sequence< string > NameList;
class FlatTree
{
string Id;
string Type;
string Name;
NameList Parents;
NameList Members;
};
the generated cpp code list bellow:
class FlatTree : virtual public ::Ice::Object
{
public:
void __copyMembers(::jf::server::FlatTreePtr) const;
virtual ::Ice::ObjectPtr ice_clone() const;
static const ::std::string __ids[2];
virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;
virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::Current()) const;
virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;
static const ::std::string& ice_staticId();
::std::string Id;
::std::string Type;
::std::string Name;
::NameList Parents;
::NameList Members;
virtual void __write(::IceInternal::BasicStream*) const;
virtual void __read(::IceInternal::BasicStream*, bool);
virtual void __write(const ::Ice::OutputStreamPtr&) const;
virtual void __read(const ::Ice::InputStreamPtr&, bool);
static const ::Ice::ObjectFactoryPtr& ice_factory();
private:
static ::Ice::ObjectFactoryPtr _factory;
};
Now, I need copy a FlatTree object:
FlatTreePtr o( new FlatTree() );
...
FlatTree o2( * o ); // copy construct is not support
FlatTree o2 = * o; // operator = is not support
then, I must do this:
FlatTreePtr o2( new FlatTree() );
o->__copyMembers( o2 );
It's feel not beautiful.
I know, mostly I needn't call copy construct function, because the Ice::Handle can copy a object to anywhere, but now I really to do this. :-)
Can slice2cpp support C++ copy construct and operator = ?

Reply With Quote