Iterator trouble?? 
Author Message
 Iterator trouble??

Hi!
Why do I get the following compiler error?
access discriminats allowed only for limited types

My code looks like this:

with Spline_Pkg; use Spline_Pkg;

package Spline_Pkg.SplineIterator_Pkg is
   type SplineIterator(S :  access Spline) is limited private;
   function Next(Si : SplineIterator) return Point3;
private
   type SplineIterator(S : access Spline)  is
      record
         Index : Natural;
      end record;
end Spline_Pkg.SplineIterator_Pkg;

with Point3_Pkg; use Point3_Pkg;

package Spline_Pkg is
   type Spline is limited private;
   type Point3Vector is array(NATURAL range <>) of Point3;
   type IntVector is array(NATURAL range <> ) of Integer;
   procedure Create(S : out Spline; Points : in Point3Vector; Steps : in
IntVector);
private
   type Spline is array(0 .. INTEGER'Last) of Point3;
end Spline_Pkg;

Thanks!
/Michael



Fri, 14 Nov 2003 09:44:18 GMT  
 Iterator trouble??

Quote:

> Why do I get the following compiler error?
> access discriminats allowed only for limited types

> with Spline_Pkg; use Spline_Pkg;

> package Spline_Pkg.SplineIterator_Pkg is
>    type SplineIterator(S :  access Spline) is limited private;
>    function Next(Si : SplineIterator) return Point3;
> private
>    type SplineIterator(S : access Spline)  is
>       record
>          Index : Natural;
>       end record;
> end Spline_Pkg.SplineIterator_Pkg;

This is because the full declaration of type Splineiterator is not
limited. You could make it limited by replacing "is record" with "is
limited record".

Note that "with Spline_Pkg;" is unnecessary; child packages
automatically have visibility to their parents.

--
Jeff Carter
"Your mother was a hamster and your father smelt of elderberries."
Monty python & the Holy Grail



Fri, 14 Nov 2003 14:44:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Visitor-Iterator (Re: object-oriented vs. functional)

2. Tuples, iterators, and multiple return values in Eiffel?

3. Continuations, Coroutines, Iterators, Threads oh my!

4. co-routines (iterators with yield in some languages)

5. Separating algorithms from containers by external iterators

6. Loop variant when using an iterator?

7. Iterators

8. List Iterators

9. iterators in Sather?

10. read only iterator

11. Newbie Q: const references/iterators

12. Newbie Q: pipelining, iterators (ISE)

 

 
Powered by phpBB® Forum Software