CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Smart pointers

Threaded View

  1. #3
    Join Date
    Feb 2017
    Posts
    674

    Re: Smart pointers

    Quote Originally Posted by OneEyeMan View Post
    How it will convert using the new syntax?
    Something like this,

    Code:
    	#include <memory>
    //
    	class Foo {};
    //
    	std::vector<std::shared_ptr<Foo>> m_myVector;
    //
    	m_myVector.push_back(std::make_shared<Foo>(/* <constructor_parameter_list> */));
    The C++ type usually referred to as "smart pointer" is called std::shared_ptr.

    std::make_shared is a convenience function that's often used to create std::shared_ptr<> objects.
    Last edited by wolle; June 27th, 2018 at 11:41 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured