Posts

Showing posts with the label construtor

C++ 11 Features and training notes

C++ 11 features Rule of 5 -Destructor -Copy construtor -Copy assignment -Move constructor -Move assignment ------------------------------------------------------------------ Range based for loop for (declaration: expression){ // do some loop stuff } // Arrays int arr[] = {1,2,3,4,5}; for (int& e:arr){     //& Lvalue reference cout << e <<endl; } // using auto keyword for(auto i : v) std::cout <<i<<"; //using rvalue refence for(auto&& i : V) std::cout<<i<<"; ------------------------------------------------------------------ Null pointer NULL is not keyword #define included in standard libraries int main(){ int*i=NULL; } leads to error error:use of undeclared identifier 'NULL' in C++ 11 nullptr is a new keyword it has its own type std::nullptr_t it is implicitly convertible to any pointer it is not impicitly convertible to i...