473,657 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: design choice

Hello,

"Stuart Golodetz" <sg*******@NdOi SaPlA.pMiPpLeEx A.ScEomwrote in message
news:SK******** *************** *******@pipex.n et...
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 Interpolatorstr uct DataContainer;

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

etc.

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

Just a thought anyway...

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

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

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

However, in Curve<Polynomia l>, 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 828

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

Similar topics

3
1811
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 abstract parent with four basic functions: Open, Read, Write, and Close. // Note alot of the stuff has been left out // just to give a basic picture class IO { public:
3
2006
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 the server. However, our customer requests that both of these two objectives to be supported by the design of the solution: 1. The photos should be encoded as JPG, and resized (if larger than a
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 the server. However, our customer requests that both of these two objectives to be supported by the design of the solution: 1. The photos should be encoded as JPG, and resized (if larger than a
0
2502
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 don't work nearly as well as they should, even for analysts and power users. The reason they haven't reached the masses is because most of the tools are so difficult to use and reveal so little
2
1817
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 school outings. I pretty much know my way around MS access, but may well need vba for this thing here, so if you have any hints and tips for me, I'd be most grateful. The outline of the day-out is as follows: There is a pool of activities...
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6167
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2731
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 we have to send another system
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.