Search:
Forum
Beginners
Small question about classes
[try Beta version]
Not logged in
register
log in
user name:
password:
remember me
forgot your password?
or sign in using:
try again
cancel
forgot your password?
Small question about classes
Feb 13, 2015 at 11:33pm
Feb 13, 2015 at 11:33pm UTC
pel1993
(46)
i am looking at code for a custom vector class and i see something like this
1
2
3
4
ClassName a; ClassName d{5}; cout<< d
what is {5} and what the difference with d(5) the intent is to store one element ' 5' into a vector like class
thanks
Feb 14, 2015 at 1:08am
Feb 14, 2015 at 1:08am UTC
LB
(13399)
It is brace initialization.
http://en.cppreference.com/w/cpp/language/aggregate_initialization
It was added in C++11 and is preferred in many cases.
Last edited on
Feb 14, 2015 at 1:08am
Feb 14, 2015 at 1:08am UTC
Feb 14, 2015 at 7:19pm
Feb 14, 2015 at 7:19pm UTC
pel1993
(46)
thanks just starting to learn all the new featured on c++11
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs