Click here to Skip to main content
15,113,855 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
Questionplease explain this lines of code Pin
Hiếu Ngô2-Aug-18 19:18
MemberHiếu Ngô2-Aug-18 19:18 
AnswerRe: please explain this lines of code Pin
Richard MacCutchan2-Aug-18 22:47
mveRichard MacCutchan2-Aug-18 22:47 
AnswerRe: please explain this lines of code Pin
Jochen Arndt2-Aug-18 23:29
professionalJochen Arndt2-Aug-18 23:29 
NewsC++/CLI support comes to ReSharper C++ Pin
John Schroedl23-Jul-18 7:22
professionalJohn Schroedl23-Jul-18 7:22 
QuestionTo find the angle of turn in a car racing game in C++/SFML Pin
Tarun Jha22-Jul-18 0:39
MemberTarun Jha22-Jul-18 0:39 
AnswerRe: To find the angle of turn in a car racing game in C++/SFML Pin
John Schroedl23-Jul-18 7:41
professionalJohn Schroedl23-Jul-18 7:41 
GeneralRe: To find the angle of turn in a car racing game in C++/SFML Pin
Tarun Jha25-Jul-18 8:36
MemberTarun Jha25-Jul-18 8:36 
QuestionSmall RAII-like cleanup class in C++/CLI Pin
John Schroedl15-Jun-18 10:08
professionalJohn Schroedl15-Jun-18 10:08 
In native code, we often use helper classes to save a reference to a member, set its value and reset it in destruction. standard stuff.

Unfortunately, I haven't found a good way in a ref class to do the same and I'm hoping for some tips here.

Since I cannot hold a reference to a member of a managed object as a member of another object, I tried using a tracking reference. Unfortunately, that results in an similar error:

C++
error C3160: 'System::Boolean ^%': a data member of a managed class cannot have this type
note: an interior reference can never be allocated on the gc heap


An example I hope to get working...

C++
ref class Foo { bool m_guard; . . . }

ref class PushBool sealed {
  bool ^% m_tref;
public:
   PushBool(bool ^% b, bool newVal) : m_tref(b), m_oldval(b) { b = newVal; }
   ~PushBool() { m_tref = m_oldval; }
};

usage...

C++
void Foo::work() {
   if (m_guard) return;
   PushBool no_reentry(m_guard, true);
   ...
   // Resets m_flag to original value here.
}


Do any of the C++/CLI devs here have advice on handling this? I can probably concoct a way to make it work but was hoping for a reusable utility class.

John
QuestionInformation Edit Source code for c++ Pin
Member 1165875229-May-18 20:48
MemberMember 1165875229-May-18 20:48 
AnswerRe: Information Edit Source code for c++ Pin
Richard MacCutchan29-May-18 22:05
mveRichard MacCutchan29-May-18 22:05 
AnswerRe: Information Edit Source code for c++ Pin
Jochen Arndt30-May-18 3:55
professionalJochen Arndt30-May-18 3:55 
QuestionError On a Project I'm Working On. (Sorry If Not descriptive enough, 1st time) Pin
CyberFaggot9-May-18 16:53
MemberCyberFaggot9-May-18 16:53 
AnswerRe: Error On a Project I'm Working On. (Sorry If Not descriptive enough, 1st time) Pin
Richard MacCutchan11-May-18 22:19
mveRichard MacCutchan11-May-18 22:19 
QuestionPrint causes in afxtls.cpp Pin
Erich Ruth19-Apr-18 6:37
MemberErich Ruth19-Apr-18 6:37 
AnswerRe: Print causes in afxtls.cpp Pin
Richard Andrew x6413-May-18 8:22
professionalRichard Andrew x6413-May-18 8:22 
QuestionWhat is the alternative of _kbhit_ in linux ? Pin
Tarun Jha16-Apr-18 5:04
MemberTarun Jha16-Apr-18 5:04 
AnswerRe: What is the alternative of _kbhit_ in linux ? Pin
Maria Okta25-Jul-18 20:23
professionalMaria Okta25-Jul-18 20:23 
QuestionMore Than One Operator "+" Matches These Operands Pin
Paramu197313-Apr-18 6:26
MemberParamu197313-Apr-18 6:26 
QuestionRe: More Than One Operator "+" Matches These Operands Pin
Richard MacCutchan13-Apr-18 6:51
mveRichard MacCutchan13-Apr-18 6:51 
AnswerRe: More Than One Operator "+" Matches These Operands Pin
Paramu197313-Apr-18 7:05
MemberParamu197313-Apr-18 7:05 
GeneralRe: More Than One Operator "+" Matches These Operands Pin
Richard MacCutchan13-Apr-18 7:40
mveRichard MacCutchan13-Apr-18 7:40 
GeneralRe: More Than One Operator "+" Matches These Operands Pin
Paramu197313-Apr-18 15:18
MemberParamu197313-Apr-18 15:18 
QuestionHow to access the ref class declared DataTable ? Pin
Paramu197311-Apr-18 22:10
MemberParamu197311-Apr-18 22:10 
SuggestionRe: How to access the ref class declared DataTable ? Pin
Richard MacCutchan11-Apr-18 23:53
mveRichard MacCutchan11-Apr-18 23:53 
GeneralRe: How to access the ref class declared DataTable ? Pin
Paramu197312-Apr-18 2:42
MemberParamu197312-Apr-18 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.