-
February 6th, 2022, 07:13 AM
#1
Reference to outer struct doesnot update
Hello,
I have a function:
Code:
void FiveGServiceGeneralPage::SaveValues()
{
FiveGServiceParams& fivegParams = m_pCurrentService->Get5gParams();
::::::::::::
// MOS Lookup
if (m_pSimulatedCurveMOSCombo->Handle)
{
const SimulatedCurve* pSimulatedCurveMOS = reinterpret_cast<const SimulatedCurve*>(m_pSimulatedCurveMOSCombo->GetItemData(m_pSimulatedCurveMOSCombo->GetSelIndex()));
fivegParams.SetSimulatedCurveMOS(pSimulatedCurveMOS);
}
:::
Im seeing that ( while debug), the fivegParams.m_pSimulatedCurveMOS has valid data input in the dialog page, but the parent reference (i.e m_pCurrentService->m_pSimulatedCurveMOS) does not get updated ...eventhough its reference !!!
In the debugger, the struct within the fivegcellparams has different memory address
fivegParams.m_pSimulatedCurveMOS 0x000000003a5e3df0
m_pCurrentService->m_pSimulatedCurveMOS 0x000000003a5e37f0
please kindly help with the inputs
Last edited by pdk5; February 6th, 2022 at 07:20 AM.
-
February 6th, 2022, 08:49 AM
#2
Re: Reference to outer struct doesnot update
What is the return type of get5gParams(). Is it a reference?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
February 6th, 2022, 09:04 AM
#3
Re: Reference to outer struct doesnot update
Originally Posted by 2kaud
What is the return type of get5gParams(). Is it a reference?
Thanks a lot kaud, for looking into this and helping me
Yes, it is reference (its legacy code)
FiveGServiceParams& TGService::Get5gParams()
{
return m_5gParams;
}
-
February 6th, 2022, 09:23 AM
#4
Re: Reference to outer struct doesnot update
sorry it was my mistake, they also defined new class in the m_pCurrentService also.. it looks like something wrong in design (it is there in two places)..getting updated one place..accessed somewhere else !!!..
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|