CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2010
    Posts
    907

    Returning a boost::shared_ptr from the stack without constructing it?

    Assuming the method returns a boost::shared_ptr<AStarPath>,
    how do I construct an AStarPath on the return statement without
    going through constructing a newPath variable?
    Thanks
    Jack

    Code:
    boost::shared_ptr<AStarPath> newPath(new AStarPath(from, transitions, totalCost));
    return newPath;
    Last edited by lucky6969b; June 28th, 2015 at 11:01 PM.

  2. #2
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: Returning a boost::shared_ptr from the stack without constructing it?

    Do you mean
    Code:
    return boost::shared_ptr<AStarPath>(new AStarPath(from, transitions, totalCost));
    Last edited by Richard.J; June 29th, 2015 at 03:28 AM. Reason: fixed code tags

  3. #3
    Join Date
    Dec 2010
    Posts
    907

    Re: Returning a boost::shared_ptr from the stack without constructing it?

    Yes, thanks, I do mean that...
    Jack

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