-
Since c++11 the STL has std::array which is a template-based array class, use std::array instead of raw arrays whenever possible.
-
Something new about iterators:
begin() and end(): iterator
cbegin() and cend(): const_iterator
rbegin() and rend(): reverse_iterator
crbegin() and crend(): const_reverse_iterator -
Whenever you put scope resolution operator in the front of something, that means global scope
eg. ::toupper() -
std::array (c++ 11)
Fixed size
Direct element access
Provides access to the underlying raw array
Use instead of raw arrays when possible
All iterators available and do not invalidate -
eg: vec.emplace_back("Larry", 18);
//vec.push_back(Person{"Larry", 18});
emplace_back is really efficient, no move no copies, it just puts it right where it's supposed to be. -
std::back_inserter constructs a back-insert iterator that inserts new elements at the end of the container it applied to.
It's a special output iterator, awesome and efficient.
eg. std::copy(vec1.begin(), vec1.end(), std::back_inserter(vec2)); -
deque: double end queue, dynamic size, not contiguous in memory.
When adding new elements, it allocates blocks in the memory, as is shown in the picture below: -
std::list
doubly linked list of elements, no direct access, rapid insertion and deletion of element anywhere (const time) -
c++11
std::forward_list
Compare to list, reverse iterator not available, No size() and back() method.
cpp_study's Introduction
cpp_study's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.