473,396 Members | 2,013 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,396 software developers and data experts.

Modern CPP Design related

In Section 1.4 of Alexandrescu's Modern C++ Design, he states the
following:

<quote>
1. You cannot specialize structure. Using templates alone you cannot
specialize the structure of a class (its data members). You can only
specialize only functions.
</quote>

What does the author mean by that? Wouldn't the following constitute
"specializing structure"?

template<typename T>
class A {
T t;
};

template<>
class A<int> {
float t;
std::string s;
};
Thanks in advance for your time.

Terribly confused,
LRS
Jul 22 '05 #1
2 1365
LRS Kumar wrote:
In Section 1.4 of Alexandrescu's Modern C++ Design, he states the
following:

<quote>
1. You cannot specialize structure. Using templates alone you cannot
specialize the structure of a class (its data members). You can only
specialize only functions.
</quote>

What does the author mean by that? Wouldn't the following constitute
"specializing structure"?
[...]


Yes, it does. But the point is that you have to repeat the whole class
definition while for member _functions_ you can specialize just one
function.
See:
http://groups.google.com/groups?hl=e....de%26rnum%3D5

Here Alexandrescu answers exactly this questions.

Wolfgang

Jul 22 '05 #2
Wolfgang Meyer <Wo************@gmx.net> wrote in message news:<40***********************@news.freenet.de>.. .

Yes, it does. But the point is that you have to repeat the whole class
definition while for member _functions_ you can specialize just one
function.
See:
http://groups.google.com/groups?hl=e....de%26rnum%3D5

Here Alexandrescu answers exactly this questions.

Wolfgang


Thanks a lot. That link helped.

LRS
Jul 22 '05 #3

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

Similar topics

22
by: Ally | last post by:
Could someone give me an example of a modern development methodology? Just to see if I'm thinking along the right lines... P.S. Sorry for the cross posting but I couldn't find a newsgroup for...
3
by: MorrganMail | last post by:
Recently got to take over the responisibility for an application which is making heavy use of an Access database. It has been a long time since I came in contact with anything database related and...
4
by: dragoncoder | last post by:
Hi all, I am reading Modern C++ design by Andrei Alexandrescu. In the Techniques chapter I came across this code for using a run time assertion. Here is the code. #include <cassert> ...
1
by: frame | last post by:
Hi, I am trying to compile the following program, whose fragments are presented in Section 2.1: "Compile-Time Assertions" of Chapter 2: "Techniques" of "Modern C++ Design" by Andrei...
3
by: Froefel | last post by:
I'm trying to modem a relationship with classes and I'm having trouble finding the correct design pattern. Maybe someone with more experience knows which pattern(s) I'm looking for. Here's an...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
2
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
54
by: csolomon | last post by:
Hello: I was wondering if I could get some input on how to address a design issue, involving my composite table. I have one portion of my project complete. The following forms and reports I...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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,...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...

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.