Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Create / maintain rule of 5

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
stoodsmj Posted - Nov 16 2016 : 4:01:13 PM
Be pretty cool to have VAssistX create and maintain these functions. They happen a lot, and to even have the boilerplate declarations and implementations would be extremely helpful.
4   L A T E S T    R E P L I E S    (Newest First)
stoodsmj Posted - Nov 25 2016 : 5:14:33 PM
Sweet - that would be very handy.
accord Posted - Nov 25 2016 : 11:29:01 AM
What I can imagine Visual Assist doing for you is creating and updating some of these methods for you, most notably the copy constructor and such. We're considering to have this as a refactoring command:

case=3945
stoodsmj Posted - Nov 24 2016 : 05:36:59 AM
Rule of 3 / 5 is explained here http://en.cppreference.com/w/cpp/language/rule_of_three

A sample code is:-

Declaration:-

class CSample
{
public:
//ctor
CSample();

//copy ctor
CSample(const CSample & theOther);

//assignment
CSample & operator=(const CSample & theOther);

//move ctor
CSample(CSample && theOther);

//move assignment
CSample & operator=(CSample && theOther);

//dtor
/* optional virtual*/ ~CSample();


protected:
int m_nInt;

CSample * m_pChild = nullptr;
};

Implementation:-
#include "stdafx.h"
#include "SampleClass.h"

CSample::CSample()
{
}

CSample::CSample(const CSample & theOther)
{
m_nInt = theOther.m_nInt;
m_pChild = new CSample(*theOther.m_pChild);
}

CSample & CSample::operator=(const CSample & theOther)
{
// TODO: insert return statement here
if (this == &theOther)
{
return *this;
}

m_nInt = theOther.m_nInt;

delete m_pChild;
m_pChild = new CSample(*theOther.m_pChild);

return *this;
}

CSample::CSample(CSample && theOther)
{

m_nInt = theOther.m_nInt;

m_pChild = theOther.m_pChild;

theOther.m_pChild = nullptr;
}

CSample & CSample::operator=(CSample && theOther)
{
// TODO: insert return statement here
if (this == &theOther)
{
return *this;
}

m_nInt = theOther.m_nInt;

delete m_pChild;
m_pChild = theOther.m_pChild;
theOther.m_pChild = nullptr;

return *this;
}

CSample::~CSample()
{
delete m_pChild;
}


Cheers,

Mike
feline Posted - Nov 17 2016 : 1:08:48 PM
Can you explain what you are talking about here? I don't recognise this term off hand. There are lots of different schools of thought for programming, and how code should be structured after all.

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