On 14/04/16 15:42 +0100, Jonathan Wakely wrote:
>On 14/04/16 06:34 -0400, Igor Gnatenko wrote:
>>ascxx/curve.h:
>>class Curve : public Instanc{
>> friend class std::vector<Curve>;
>>private:
>> friend class Plot;
>> explicit Curve(const Instanc &);
>> Curve();
>>public:
>> Curve(const Curve &);
>> std::vector<double> x;
>> std::vector<double> y;
>> const std::string getLegend() const;
>>
>> /**
>> Get the curve format string, as used by matplotlib.
>> Documented here:
>>
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes....
>>
>> (This value is not used by the Tcl/Tk GUI.)
>> */
>> const std::string getFormat() const;
>>};
>>
>>ascxx/ascpy.i:
>>%ignore Curve::Curve();
>>
>>%include "curve.h"
>>
>>
>>It should be ignored by SWIG, but looks like it's not...
>
>I don't think that's the problem.
>
>In C++98 constructing std::vector<X> v(1); would invoke X's default
>constructor in the caller's context, so if the default constructor is
>private then the caller must be a member or friend of X.
>
>In C++11 the default constructor will be invoked deep inside
>std::vector, or one of its helper functions.
>
>The code is basically invalid in C++11. It should either make the
>default constructor public (the simplest fix), or change how the
>vector is constructed (which seems to come from Swig, so might be
>difficult).
Having managed to do a mock build (very slow wifi in the building I'm
in now) I see the error comes from this line, where arg1 is
vector<Curve>::size_type:
result = (std::vector< Curve > *)new std::vector< Curve >(arg1);
Which is exactly what I guessed. That is not valid C++11 if the Curve
default constructor is private.
I can also confirm that making the Curve default constructor public
allows the build to complete.