Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
Thread beginning with comment 548304
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[4]: true, but some libraries...
by kwan_e on Fri 11th Jan 2013 02:59
in reply to "RE[3]: true, but some libraries..."
RE[4]: true, but some libraries...
by ebasconp on Fri 11th Jan 2013 19:41
in reply to "RE[3]: true, but some libraries..."
The C++ way of dealing with problems caused by complexity is to add more complexity.
- Brendan
- Brendan
Are you sure what are you talking about?
C++03:
------
vector<Object*> objs = get_objects();
for (vector<Object*>::const_iterator i = v.begin(); i != v.end(); ++v)
{
cout << (*i)->toString() << endl;
}
for (vector<Object*>::iterator i = v.begin(); i != v.end(); ++v)
delete *i;
C++11:
------
vector<shared_ptr<Object>> objs = get_objects();
for (auto& s : v)
{
cout << s->toString() << endl;
}
The C++11 stuff is easier to read, easier to program, does not need to deal with memory manually and is exception-safe.
Introducing range-based for loops, static type deduction, move semantics, shared pointers and a lot of interesting stuff, they simplified the language, made the libraries more efficient and they kept backwards compatibility.
Edited 2013-01-11 19:48 UTC
RE[5]: true, but some libraries...
by Luminair on Sat 12th Jan 2013 09:32
in reply to "RE[4]: true, but some libraries..."





Member since:
2005-11-16
Hi,
As far as I can tell, for all programming languages the majority of problems/bugs are caused by people having trouble dealing with complexity.
The C++ way of dealing with problems caused by complexity is to add more complexity.
- Brendan