Re: Error compiling dictionary for class with auto_ptr

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 5 Mar 2010 16:06:38 -0600


Hi Nick,

Currently cint does not support well auto_ptr, so you can simply hide the function from CINT:

#include <memory>

class test
{
public:
#ifndef __CINT__

   std::auto_ptr<int> SomeFun(void) const; #endif
};

Cheers,
Philippe.

On 3/5/10 4:01 PM, Nicholas Devenish wrote:
> Hi Roottalk,
>
> I'm getting an error compiling the dictionaries for a class that
> returns an auto_ptr from a const function. The problem is with a
> member function of the form:
> std::auto_ptr<int> SomeFun(void) const;
>
> which results in the dictionary code:
> const auto_ptr<int>* pobj;
> const auto_ptr<int> xobj = ((const test*)
> G__getstructoffset())->GetInt();
> pobj = new auto_ptr<int>(xobj);
>
> Giving the error when trying to compile the third line:
> error: passing ‘const std::auto_ptr<int>’ as ‘this’ argument of
> ‘std::auto_ptr<int>::operator std::auto_ptr_ref<int>()’ discards
> qualifiers
> because a non-const auto_ptr cannot be initialised by a const auto_ptr.
>
> Attached is a *very* small test file that exhibits this behaviour,
> compiled with
> rootcint out.cxx -c test.h
> g++ -c out.cxx `root-config --cflags`
>
> Is there a way to get the dictionaries to compile properly?
>
> Thanks,
>
> Nick
>
Received on Fri Mar 05 2010 - 23:06:43 CET

This archive was generated by hypermail 2.2.0 : Sat Mar 06 2010 - 05:50:02 CET