octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation error: auto_ptr and private class


From: John Swensen
Subject: Re: Compilation error: auto_ptr and private class
Date: Fri, 12 Feb 2010 13:08:32 -0500

On Feb 12, 2010, at 11:12 AM, Michael Goffioul wrote:

> On Fri, Feb 12, 2010 at 3:47 PM, John Swensen <address@hidden> wrote:
>> I started adding in more components of the class and ran into a problem that
>> make me think there will be another problem (and makes me wonder how it even
>> works with other compilers).  As part of the idx_vector class, there is the
>> following function:
>> 
>> // The shared empty vector representation (for fast default constructor)
>> 
>>   427   static idx_vector_rep *nil_rep (void)
>> 
>>   428     {
>> 
>>   429       static idx_vector_rep ivr;
>> 
>>   430       return &ivr;
>> 
>>   431     }
>> 
>> I get an error about being unable to instantiate idx_vector_rep (in my case
>> the A class) because B::fun is an abstract function.
>> John
> 
> If I refer to the test file I sent:
> A <=> idx_vector
> B <=> idx_vector::idx_base_rep
> C <=> idx_vector::idx_vector_rep
> 
> So the equivalent of the above code would be:
> 
> static C* nil_rep (void)
> {
>  static C ivr;
>  return &ivr;
> }
> 
> In other words, you don't instantiate A::B directly.
> 
> Another thing that might be good to add is the __declspec(dllexport)
> decoration to the various classes. This usually have an effect on how
> MSVC instantiates classes.
> 
> Michael.

I fixed my mistake w.r.t. the nil_rep function and added the declspec stuff.  
Still no luck.  I even tried to created the templated constructors to see if 
that was causing the problem.  I can't get it to fail to compile.  What version 
of MSVC++ are you using?

John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]