Use using using instead of typedef__c++ in c++11

Source: Internet
Author: User

Example 1:

void F () {} 
int main ()
{
    using functionptr = void (*) ();///equivalent to typedef void (*FUNCTIONPTR) ();
 
    FunctionPtr ptr = f;
}
Example 2:
typedef unsigned char U1;
typedef unsigned short U2;


Using U4 = uint32_t;
Using U8 = uint64_t;


Example 3:
Using Line_no = std::vector<string>::size_type;
Equivalent to: typedef vector<string>::size_type LINE_NO;


Example 4:
typedef std::unique_ptr<std::unordered_map<std::string, std::string>> UPTRMAPSS;
Using UPTRMAPSS = std::unique_ptr<std::unordered_map<std::string, std::string>>;
C + + Standard Template Library from getting started to mastering
http://edu.csdn.net/course/detail/3324
Learn C + + with old rookie
http://edu.csdn.net/course/detail/2901
Visual Studio 2015 Basic use of developing C + + programs
http://edu.csdn.net/course/detail/2570
Using the PROTOBUF protocol in VC2015.
http://edu.csdn.net/course/detail/2582


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.