[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation error: auto_ptr and private class
From: |
Jaroslav Hajek |
Subject: |
Re: Compilation error: auto_ptr and private class |
Date: |
Fri, 12 Feb 2010 09:52:08 +0100 |
On Fri, Feb 12, 2010 at 9:05 AM, Michael Goffioul
<address@hidden> wrote:
> Hi,
>
> I'm getting the following compiling error with MSC. Any hint?
>
> Michael.
>
Another bug in MSVC++, IMO. See C++ standard, sec. 14.3, paragraph 3:
The name of a template-argument shall be accessible at the point
where it is used as a template-argument.
[Note: if the name of the template-argument is accessible at the
point where it is used as a template-
argument, there is no further access restriction in the resulting
instantiation where the corresponding
template-parameter name is used. ] [Example:
template<class T> class X {
static T t;
};
class Y {
private:
struct S { /* ... */ };
// OK: S is accessible
X<S> x;
// X<Y::S> has a
static member of type Y::S
// OK: even though
Y::S is private
};
// error: S not accessible
X<Y::S> y;
—end example] For a template-argument of class type, the template
definition has no special access rights
to the inaccessible members of the template argument type.
Pretty clear, I think. The rule serves exactly this purpose: so that
you can use standard templates on your private classes.
Since the destructor is public in idx_vector::idx_vector_rep,
std::auto_ptr should be able to access it. As a workaround, I suggest
you try making the nested class idx_vector::idx_vector_rep public in
idx_vector. Or switch to gcc, but you knew that :)
cheers
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class,
Jaroslav Hajek <=
- Re: Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class, John Swensen, 2010/02/12
- Re: Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class, John Swensen, 2010/02/12
- Message not available
- Re: Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class, John Swensen, 2010/02/12
- Re: Compilation error: auto_ptr and private class, Jaroslav Hajek, 2010/02/12
- Re: Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class, Michael Goffioul, 2010/02/12
- Re: Compilation error: auto_ptr and private class, Jaroslav Hajek, 2010/02/12