473,378 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Reducing the number of typed parameters

Efi
Hello,
I have the following two classes:
class Chunk<T,V1{
V1 value;
T data;
}

class Feature<T,V2>{
V2 value;
T data}

I am writing a class that in essence transforms a Chunk into a
Feature.
class Transform<T,V1,V2...
public Feature<T,V2transform (Chunk<T,V2foo)...

Chunk and Feature has a common typed parameter(T) which I'm enforcing
when I'm declaring the Transform class.

I think that the transform class is just too confusing when I'm using
it with 3 typed parameters, I would like to reduce the number of typed
parameters and still have the same functionality.

At the beginning I thought using constraints i.e.
class Transform<U,Vwhere T : Chunk V : Feature

however in order to use it I need to add type to Chunk and Feature
i.e.
where T : Chunk<T,V1>
so it didn't help me.

What do you think, how can I do it?

Thank you,
Efi

Mar 12 '07 #1
3 1379
Efi <fo****@gmail.comwrote:
I have the following two classes:
class Chunk<T,V1{
V1 value;
T data;
}

class Feature<T,V2>{
V2 value;
T data}

I am writing a class that in essence transforms a Chunk into a
Feature.
class Transform<T,V1,V2...
public Feature<T,V2transform (Chunk<T,V2foo)...

Chunk and Feature has a common typed parameter(T) which I'm enforcing
when I'm declaring the Transform class.

I think that the transform class is just too confusing when I'm using
it with 3 typed parameters, I would like to reduce the number of typed
parameters and still have the same functionality.
I don't see how that's possible. There are three types involved, so
assuming they could all me different, I fail to see how you can get rid
of one of them.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 12 '07 #2
Efi

Jon כתב:
>
I don't see how that's possible. There are three types involved, so
assuming they could all me different, I fail to see how you can get rid
of one of them.
Thanks,
I agree with you, but the point here that one parameter is always the
same in Chunk and Feature - T.

T can have different types that is true.
I agree with you, I was hoping that there is some way to exploit this
common parameter.

Thanks anyway,
Efi

Mar 12 '07 #3
Efi <fo****@gmail.comwrote:
I don't see how that's possible. There are three types involved, so
assuming they could all me different, I fail to see how you can get rid
of one of them.

Thanks,
I agree with you, but the point here that one parameter is always the
same in Chunk and Feature - T.
Which is why you have three parameters rather than 4. If the two Ts
could be different, it would have to be:

public Feature<T1,V2transform (Chunk<T2,V2foo)...
T can have different types that is true.
I agree with you, I was hoping that there is some way to exploit this
common parameter.
You already are doing.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Ralf W. Grosse-Kunstleve | last post by:
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object):...
14
by: Jason Heyes | last post by:
I have read item 26 of "Exceptional C++" that explains a way of minimising compile-time dependencies and, therefore, a way to improve compile speeds. The procedure involves replacing #include...
0
by: Filipe Martins | last post by:
Hello to all. Ever had a problem when your print some reports in a printer other the one you use more frequently, in which the report width span more tban one page? I did, and didn't liked it. ...
6
by: John Wood | last post by:
As everybody points out, the best way to reduce the memory footprint of a ..net application is to minimize it and restore it. This can make my app go from 40Mb of usage to about 3Mb of usage. Of...
1
by: ErnieJ | last post by:
I a have a .net application which displays the results of a database query on a form in graphical format (i.e. charts and maps). This application is launched from another legacy Windows...
21
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but...
12
tdw
by: tdw | last post by:
Hi, I have taken over an orders database that someone else created. I have basically backwards engineered it, thereby learning Access and VBA on my own. I have successfully made many improvements...
7
by: dataangel | last post by:
After spending a lot of time writing code in other languages, returning to C++ and starting a new project has been painful. It seems in order to get anything done you need to #include, add linker...
5
by: albert | last post by:
Hello, Doing a simple division, I obtain this number : 0.0024096385542168672344587321276776492595672607421875 I'd like to have 0.0024 instead. I know the number_format function but is it the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.