From: Dale Stanbrough <dale@goanna.cs.rmit.EDU.AU>
Subject: Re: argument of conversion cannot be an allocator
Date: 1997/05/16
Date: 1997-05-16T00:00:00+00:00 [thread overview]
Message-ID: <5lganc$gjp$1@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: 5lbccj$7vk$1@goanna.cs.rmit.edu.au
Robert Dewar writes:
"The reason is obvious, a conversion provides no context for its operand,
so you have to be able to tell what the type of the operand is by looking
at it, but an allocator is no good, since it only knows its type from
context. The fix is far simpler than what you have:
a_ptr (b_ptr'(new b))
although I am a little surprised that just plain a_ptr'(new b) does not
work, why do you need a conversion here at all?"
Ah, so are you saying the the type conversion (a_ptr) only "looks at"
the "new", and can't deduce (or doesn't have to) the resultant type from
the "new b"?
I've since found out that i don't need the conversion at all. The function
i was writing was defined as returning a pointer (or access type :-)
to a parent type, while the body was returning pointers to derived types.
I figured you should be able to do this, but didn't realise there would
be automatic type conversion b/w b_ptr and a_ptr (even though this is
quite safe) (or is it a view conversion?).
Dale
next prev parent reply other threads:[~1997-05-16 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-14 0:00 argument of conversion cannot be an allocator Dale Stanbrough
1997-05-14 0:00 ` Peter Hermann
1997-05-16 0:00 ` Dale Stanbrough [this message]
1997-05-16 0:00 ` Robert Dewar
1997-05-17 0:00 ` John G. Volan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox