RValue-Reference, Move Constructor and Perfect Forwarding

Categories: cpp
Background I’ve thought I was good at C++, however, after my friend asking me about rvalue, I realized that I knew nothing about the strength of C++. In this article, I won’t introduce either rvalue or move constructor. Instead, I will describe and dig into his question and try to explain what benefits the move constructor provides. Question For std::map::insert, there are two overloadings: since C++11 template <classP> std::pair<iterator, bool> insert(P&& value); since C++17

Read More →

C++ Virtual Table - Explained thru Assemblies

Categories: cpp
C++ Virtual Table Code C++ Sources #include <string>#include <iostream> classBase { public: virtual const char* Name() const { return "Base"; } virtual const char* BaseName() const { return "Base"; } int a = 1; int t = 2; }; classDerivedC : public Base { public: virtual const char* Name() const override { return "Derived"; } int b = 3; double c = 4.0; }; int main() { Base* base = new DerivedC; base->Name(); base->BaseName(); delete base; return 0; } Compiled Assemblies .

Read More →

My New Life

Categories: Life
June 30, I left my school after graduation. I have no permission to re-enter my dorm. July 3, I started my new life working at Microsoft and living in my rented house with a roommate who was my roommate at school. Nothing really changed so far. I often go back to school to be with my girlfriend. I can still read books in the library and have lunch in canteen.

Read More →

About Me

Hongxu Xu Contact Email: xuhongxu96@hotmail.com LinkedIn: https://cn.linkedin.com/in/xuhongxu GitHub: https://github.com/xuhongxu96 Facebook: Hongxu.Xu QQ: 469614686 Experience Date Position Location 2018.7 - Now SDE Microsoft 2014.8 - 2018.7 CS Undergraduate College of Information Science and Technology Beijing Normal University

Read More →