comp.lang.ada
 help / color / mirror / Atom feed
From: "R. Stegers" <rstegers@cs.vu.nl>
Subject: Re: Parallel Merge Sort
Date: Mon, 18 Feb 2002 22:02:23 +0100
Date: 2002-02-18T22:02:23+01:00	[thread overview]
Message-ID: <a4rq83$cis$1@star.cs.vu.nl> (raw)
In-Reply-To: 0sgb8.36$hk2.28284109@newssvr14.news.prodigy.com

Maybe someone can help me solve one final little issue.

The parallel Merge Sort works fine now. But when I want to use it I cannot
directly declare for example an integer array:

  package IntSort is new SORT_PACKAGE(integer, compareInt);
  use IntSort;

  -- This declaration does not work when I want to use ar as a parameter in
a call to Sort.
  ar : integer array(1..3);

  -- Instead I have to use this.
  ar : IntSort.element_array(1.. 3);

  sort(ar);

This is the declaration of the package:

  generic
    type element_type is private;
    with function "<=" (element1, element2 : element_type) return Boolean;
  package SORT_PACKAGE is

    type element_array is array(integer range <>) of element_type;

    procedure Sort(InArray : in out element_array);

    < ... >
  end SORT_PACKAGE;

I figured that since 'type' creates a new type, which cannot be interchanged
(?) with the original type I would have to use Subtype instead.
Unfortunately the compiler won't accept...

It's only a minor issue but if you want to do it right...

Does anybody know if it's possible??





  parent reply	other threads:[~2002-02-18 21:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-15 21:34 Parallel Merge Sort R. Stegers
2002-02-15 21:46 ` Pat Rogers
2002-02-19  6:16   ` Adrian Hoe
2002-02-19  6:21   ` Adrian Hoe
2002-02-15 23:02 ` tmoran
2002-02-16 11:09   ` R. Stegers
2002-02-18 10:22     ` Peter Hermann
2002-02-18 20:41       ` R. Stegers
2002-02-18 21:02   ` R. Stegers [this message]
2002-02-18 22:29     ` Jeffrey Carter
2002-02-18 22:55     ` tmoran
2002-02-19 21:46   ` Kenneth Almquist
2002-02-24  3:22 ` Nick Roberts
2002-02-26 20:39   ` R. Stegers
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox