Design question about using templates
  Home FAQ Contact Sign in
comp.lang.c++ only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.c++ Profile…
 Up
Design question about using templates         


Author: Anja
Date: Feb 21, 2008 17:27

Hi everyone,

I am using a third party library that uses templates quite heavily for
generalization. It is an image processing library and for example a
typical "Image" class has the following definition:

Image

The PixelType here represents the data type of the underlying
data...could be anything from chars to complex numbers and the
Dimensions are the dimensions of the image...which could be 2D to 4D
(3D and time).

Now, my problem is that I need to instantiate and [I]store[/I] these
objects in my class. With non-templated objects it is trivial as
everything is known at compile time.

However, with this object, I do not know the PixelType and Dimensions
till run-time! So, I cannot, for example, have a member variable in a
class of the Image type. However, that is exactly what I need to do. I
need to create the image object and then later access this image
object and use its functions.
Show full article (2.17Kb)
3 Comments
Re: Design question about using templates         


Author: kwikius
Date: Feb 21, 2008 18:45

On Feb 22, 1:27 am, Anja googlemail.com> wrote:
> Hi everyone,
>
> I am using a third party library that uses templates quite heavily for
> generalization. It is an image processing library and for example a
> typical "Image" class has the following definition:
>
> Image
>
> The PixelType here represents the data type of the underlying
> data...could be anything from chars to complex numbers and the
> Dimensions are the dimensions of the image...which could be 2D to 4D
> (3D and time).
>
> Now, my problem is that I need to instantiate and [I]store[/I] these
> objects in my class. With non-templated objects it is trivial as
> everything is known at compile time.
>
> However, with this object, I do not know the PixelType and Dimensions
> till run-time! So, I cannot, for example, have a member variable in a ...
Show full article (2.68Kb)
no comments
Re: Design question about using templates         


Author: Anja
Date: Feb 21, 2008 23:04

On Feb 22, 2:45 am, kwikius servocomm.freeserve.co.uk> wrote:
> On Feb 22, 1:27 am, Anja googlemail.com> wrote:
>
>
>
>> Hi everyone,
>
>> I am using a third party library that uses templates quite heavily for
>> generalization. It is an image processing library and for example a
>> typical "Image" class has the following definition:
>
>> Image
>
>> The PixelType here represents the data type of the underlying
>> data...could be anything from chars to complex numbers and the
>> Dimensions are the dimensions of the image...which could be 2D to 4D
>> (3D and time).
>
>> Now, my problem is that I need to instantiate and [I]store[/I] these
>> objects in my class. With non-templated objects it is trivial as ...
Show full article (3.28Kb)
no comments
Re: Design question about using templates         


Author: Alf P. Steinbach
Date: Feb 21, 2008 23:45

* Anja:
> Hi everyone,
>
> I am using a third party library that uses templates quite heavily for
> generalization. It is an image processing library and for example a
> typical "Image" class has the following definition:
>
> Image
>
> The PixelType here represents the data type of the underlying
> data...could be anything from chars to complex numbers and the
> Dimensions are the dimensions of the image...which could be 2D to 4D
> (3D and time).
>
> Now, my problem is that I need to instantiate and [I]store[/I] these
> objects in my class. With non-templated objects it is trivial as
> everything is known at compile time.
>
> However, with this object, I do not know the PixelType and Dimensions
> till run-time! So, I cannot, for example, have a member variable in a ...
Show full article (3.64Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Re: How to use Application Template Timecard Managementmicrosoft.public.sharepoint.setup_and_administration ·
has anyone used a template from Template Monster?netobjects.fusion10.webdesign ·