Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the application skills of C++ standard extension

Shulou Source: shulou.com Published: 2022-06-02 09:43:24 09月27日 Update

This article introduces the relevant knowledge of "what is the application skill of C++ standard extension". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Today experiment C++ standard extensions in the use of shared_ptr, the results in gcc4.1 how also compiled in the past, check the Internet, but also downloaded the TR1 manual. Finally, I understand that you have to add it to #include

#include

< tr1/memory>

#include

< iostream>

#include

< string>

#include

< tr1/array>

#include

< tr1/memory>

using namespace std;

using std::tr1::shared_ptr;

class Widget

{

public:

Widget()

{

pstr = new string("Hello world! ");

cout

< < "Widget's construction is called" < < endl; } Widget(const Widget& rhs) { cout < < "Widget's copy construction is called" < < endl; } Widget& operator=(const Widget& rhs) { return *this; } ~Widget() { delete pstr; cout < < "Destruction is called" < < endl; } private: string* pstr; }; int main() { auto_ptr< Widget>

pInv(new Widget);

auto_ptr

< Widget>

pInv2(pInv);

shared_ptr

< Widget>

pInvN(new Widget);

array

< int, 5>

a = {{1,2,3,4,5}};

cout < < a[3] < < endl;

return 0;

}

This file. Hehe, maybe I was too careless! The C++ standard extension, according to TR1, mainly includes:

Reference Wrappers Shared_ptr result_of mem_fn Function Object Binders Polymorphic Function Wrappers Type Traits Random Numbers Tuples Array Hash Functions Regular Expressions Complex Number Algorithms

These C++ standard extensions, we see the long-awaited regular expressions are also here Oh!

"C++ standard extension application skills is what" the content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Standard Clearing skills application skills application content more knowledge part practicality achievement next dilemma reality situation manual document article case rule Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Shulou Technology macOS vpn