Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Add shortcut for shared and unique ptr

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
EugeneKozlov Posted - Oct 22 2015 : 1:35:05 PM
Hello,

There is a nice shortcut for assingment to pointer:
Class* ptr = [new Class()]
Can you please add same thing for shared_ptr and unique_ptr?

Thank you.
2   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Dec 16 2015 : 9:02:29 PM
case=92897 is implemented in build 2086

By default, VA will suggest two forms of make_shared/make_unique. The suggestions can be configured via the registry DWORD value named "SmartPointerSuggestionStyles".

The value is a bitfield and can be any combination of:
1 --> offers std::make_shared<CFoo>()
2 --> offers std::make_shared<CFoo>(
4 --> offers std::make_shared<CFoo>($end$)

The default value is 3 (1 | 2) -- two suggestions by default.

Each bit value adds a different suggestion to the suggestion list

Given:
std::shared_ptr<CFoo>() pw =

suggestions are:
1 std::make_shared<CFoo>()
2: std::make_shared<CFoo>(
4: std::make_shared<CFoo>($end$)

1 and 3 differ only by caret position after insert (3 leaves caret between the parens, whereas 1 leaves caret at end of inserted text).
feline Posted - Oct 22 2015 : 5:33:16 PM
That makes a lot of sense, I have put in a feature request to see what our developers make of this:

case=92897

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000