473,503 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: design choice

Hello,

"Stuart Golodetz" <sg*******@NdOiSaPlA.pMiPpLeExA.ScEomwrote in message
news:SK******************************@pipex.net...
As far as the first question goes (and just off the top of my head), you
may be able to avoid partially specializing Curve if you define a
templated DataContainer type and partially specialize that instead. In
other words, something like:

template <typename Interpolatorstruct DataContainer;

template <struct DataContainer<Constant>
{
typedef std::map<double,doubletype;
};

etc.

template <typename Interpolator, typename Extrapolator, typename
Integrator>
class Curve
{
// can use (typename) DataContainer<Interpolator>::type here
};

Just a thought anyway...

Note that this provides one possible solution to your problem with the
function signatures: for example, Constant::interpolate now takes a
DataContainer<Constant>& as its first argument, etc.
this works well, thank you.

i have 1 more question:
I would do this:
template <struct DataContainer<Constant>
{
typedef std::map<double,doubletype;
};

and
template <struct DataContainer<Ploynomial>
{
typedef struct {
double* data[2];
size_t size;
} type;
};

However, in Curve<Polynomial>, i have
double& operator(double x); // to insert a new x in the tabulated data

for Constant with map, this is trivial {
return map[x];
}
for Polynomial, with double*[2]
i have to manage it myself, the sorting/inserting into the array,
it seems like redundant work thatt can be done better by stdlib c++

is there a way to get double*[2] frm map<double, double(i cuold write it)
should i keep both map<double, doubleand the double*[2] for the case of
Poynomial,
using the map for inserting, and then using the double*[2] to do the
interpolation
(because it requires random access iterators)

rds,
Jun 27 '08 #1
0 819

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

Similar topics

3
1801
by: fernandez.dan | last post by:
I'm still learning how to use Object Oriented concepts. I'm have a basic question dealing with design. I have two classes that deal with I/O pertaining to network and usb that inherit from an...
3
1988
by: Sorin Dolha | last post by:
Hello, We intend to create an ASP.NET-based Web application (hosted on Internet Information Services, or IIS) and one feature of the application needs to allow the end user to upload photos to...
3
291
by: Sorin Dolha | last post by:
Hello, We intend to create an ASP.NET-based Web application (hosted on Internet Information Services, or IIS) and one feature of the application needs to allow the end user to upload photos to...
0
2492
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
2
1809
by: thecheyenne | last post by:
Hi and good evening / good morning (depending on your location on this planet) Despite my limited - o.k, non-existing - knowledge of vba, I'd like to design a database to help with the admin of...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.