473,388 Members | 1,215 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,388 software developers and data experts.

what mean: const A&a = A() ?

hello,
here is an example: in class vector

explicit vector(size_type n, const T& val = T(), const A&a =
A()):alloc(a)
{...}
vector I mentioned above is a constructor of a template class:

template <class T, class A = allocator<T class vector{...};

so, I don't know what means = A(), because A is a typename here. Thank
you very much.

Nov 12 '06 #1
2 1724
ni**************@126.com wrote:
...
so, I don't know what means = A(), because A is a typename here. Thank
you very much.
...
If 'A' is a type, 'A()' is an expression that evaluates to a
default-initialized object of type 'A' (a _value_-initialized object of
type 'A' in post-TC1 C++). For example, 'int()' evaluates to 0.
'double()' evaluates to 0.0. 'std::string()' produces a
default-constructed temporary object of type 'std::string'. And so on.

--
Best regards,
Andrey Tarasevich

Nov 12 '06 #2
Thanks, that's very helpful
"Andrey Tarasevich дµÀ£º
"
ni**************@126.com wrote:
...
so, I don't know what means = A(), because A is a typename here. Thank
you very much.
...

If 'A' is a type, 'A()' is an expression that evaluates to a
default-initialized object of type 'A' (a _value_-initialized object of
type 'A' in post-TC1 C++). For example, 'int()' evaluates to 0.
'double()' evaluates to 0.0. 'std::string()' produces a
default-constructed temporary object of type 'std::string'. And so on.

--
Best regards,
Andrey Tarasevich
Nov 12 '06 #3

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

Similar topics

2
by: CoolPint | last post by:
Can anyone clearly explain the difference between constant reference to pointers and reference to constant pointers? What is const int * & ? Is it a constant reference to a pointer to an...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
3
by: Alexander Farber | last post by:
Hi, does anyone have an idea, why do I get the following error (I have to use g++296 on RedHat Linux as compiler): In file included from r_dir.cpp:9: r_obey.h:262: declaration of `const...
8
by: dwaach | last post by:
what does T*VQ& mean where T is object type, VQ is volatile or empty, Is this correct, struct X {}; volatile X ox;
8
by: QQ | last post by:
SpreadsheetCell(const string& initialValue); I don't understand what & means here? Thank you very much! A C++ beginner
6
by: Geoffrey S. Knauth | last post by:
It's been a while since I programmed in C++, and the language sure has changed. Usually I can figure out why something no longer compiles, but this time I'm stumped. A friend has a problem he...
12
by: Benjamin B. | last post by:
Hi everyone, in this thing I inherited there's a statement like this: a &= ~b; where a is an int and b has been declared this way: const b = 0x0002;
1
by: developereo | last post by:
Hi folks, Can somebodyshed some light on this problem? class Interface { protected: Interface() { ...} virtual ~Interface() { ... } public:
2
by: dolphin | last post by:
Why should we use fun(const Class &B) instead of fun(Class &B)?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...

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.