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: Michael Goffioul
Subject: Re: Compilation error: auto_ptr and private class
Date: Fri, 12 Feb 2010 16:12:23 +0000

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.



reply via email to

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