-
July 28th, 2016, 09:32 AM
#1
Migrating code from VS2008 to VS2010
All,
I#m still converting code from VS2008 to VS 2010
I chased this error for hours, without success.
Error:
"std::_Tree_unchecked_const_iterator<_Mytree,_Base>::operator ->":
Code:
#include <set>
for(SubType::iterator i=tmp.sub.begin();i!=tmp.sub.end();++i){
if(i->streaming){
if(fGlobalStreaming||!i->updated){
TFormula* f=i->f;
f->Set(i->o,tmp.xl);
i->updated=true;
}
}else{
if(!i->updated){
i->f->Set(i->o,tmp.xl);
i->updated=true;
}
}
}
I understood that I have to avoid changing values of const items, not a prob. But there is no const item.
I found that std::set is always provoking const values. But how to avoid this?
Any hint much appreciated,
thx,
24plus7
-
July 28th, 2016, 10:03 AM
#2
Re: Migrating code from VS2008 to VS2010
The VS2010 version is correct. You can't change the values of a set
since it could change the order of the elements.
There are a couple of workarounds
1) remove the element from the set and insert a new element with updated
values. This could be tricky when looping over the set the way that you are.
2) use a map instead, with the "key" being the part of the object that takes part
in the ordering function and the "value" being everything else. In this case,
you can change the "value" part at any time (but not the key).
3) I have seen people use mutable, but that doesn't seem like a good idea to me.
-
July 28th, 2016, 12:26 PM
#3
Re: Migrating code from VS2008 to VS2010
Why update to VS2010 - when the current version is VS2015?
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)
-
July 29th, 2016, 03:17 AM
#4
Re: Migrating code from VS2008 to VS2010
Originally Posted by 2kaud
Why update to VS2010 - when the current version is VS2015?
VS2010 to VS2015 is next step. Migrating from 2008 to 2015 in one step makes me grey haired ...
Too many changes/bug fixing within the compilers as I have seen.
/24plus7
-
July 29th, 2016, 03:33 AM
#5
Re: Migrating code from VS2008 to VS2010
Thx for your reply Philip!
What is the "... element.." in regards of topic 1?
I will study solution 2 but I'm not quite sure I can handle it ...
I'm sure 'mutable' is not a professional solution but a band aid for a first bug fixing.
Would you have a link to an example pls? My 1st and 2nd try didn't help. Thx in advance.
/24plus7
P.S.: Hm. I studied some 'mutable' stuff. Doesn't look like a good idea. But ...
Last edited by 24plus7; July 29th, 2016 at 05:20 AM.
-
August 1st, 2016, 08:38 AM
#6
Re: Migrating code from VS2008 to VS2010
Hi,
this is the function causing that error:
Code:
#include <process.h>
#include <time.h>
#include <atlbase.h>
#include <WTL/atlapp.h>
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
#include <random>
#include <tuple>
#include <regex>
#include <ConfigClass.h>
#include <DebugClass.hpp>
#include <WinApi.hpp>
#include <Exception.hpp>
#include <XML.hpp>
#include <customdata.h>
#include "HTTPTransport.hpp"
#include "resource.h"
void ServerAdapter::TransferSymbolToVB(const Symbol& symbol) {
valueBuffer_->Update(symbol);
}
May be someone could give me an impression how I have to workaround
this piece of code.
Thx in advance
24plus7
Last edited by 24plus7; August 1st, 2016 at 08:42 AM.
-
August 4th, 2016, 03:57 PM
#7
Re: Migrating code from VS2008 to VS2010
Originally Posted by 24plus7
Hi,
this is the function causing that error:
Code:
...
void ServerAdapter::TransferSymbolToVB(const Symbol& symbol) {
valueBuffer_->Update(symbol);
}
May be someone could give me an impression how I have to workaround
this piece of code.
Well,
what is Symbol?
what is valueBuffer_?
what is Update(...)?
Victor Nijegorodov
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
|