Directory:
1.std::share_ptr Smart pointers:
2.std::tr1::function template class:
3.stringstream:
4.set/vector/map:
5.static_cast<class > (expression);
Std::share_ptr Smart pointers:
Http://en.cppreference.com/w/cpp/memory/shared_ptr
Smart pointer shared_ptr<_class>, defined in <memory> .
A pointer representing the _class type that avoids pointer errors by means of reference counting;
Std::unique_ptr
Std::tr1::function template class:
#include <tr1/functional>
typedef std::tr1::function<void (int) > handlerevent;
In C + +, TR1 (Technology Report) contains a function template class and bind template functions. They can be used to implement functions similar to function pointers .
Function<void () > F (_f);//???
Inside the class is called the Internal class (private);
Vector<char> *data
-----Function::member-----
StringStream:
#include <sstream>
C + + introduces the Three classes of Ostringstream, Istringstream,StringStream , and to use them to create an object must contain sstream.h Header file.
Set/vector/map:
#include <set>
#include <map>
#include <vector>
Set::insert (object);
Std::vector
Defined in Header <vector> |
template< Class T, Class Allocator = std::allocator<t> > class vector; |
Std::vector is a sequence container that encapsulates dynamic size arrays.
The elements is stored contiguously, which means that elements can is accessed not only through iterators, but also using Offsets on regular pointers to elements. This means, a pointer to an element of a vector is passed to any function that expects a pointer to an element of An array. |
Map is an associative container;
Static_cast<class > (expression):
Meaning:
Return eventmanager* ' s object equal arg;
static_cast<new_type> (expression);
#include <algrithm>
Pop *_frist to * (_last-1) and reheap,using _pred;
Shared_from_this ();
Std::enable_shared_from_this::shared_from_this;
Shared_ptr<t> Shared_from_this (); |
(1) |
Shared_ptr<t const> shared_from_this () const; |
(2) |
Returns a std::shared_ptr<t> that shares ownership of *this with all existing std::shared_ptr the refer to *this.
C++11 Notes 1