dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Migrating code from VS2008 to VS2010

  1. #1
    Join Date
    Jul 2016
    Location
    Munich
    Posts
    4

    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

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,716

    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.

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,925

    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++17 Compiler: Microsoft VS2019 (16.4.0)

  4. #4
    Join Date
    Jul 2016
    Location
    Munich
    Posts
    4

    Re: Migrating code from VS2008 to VS2010

    Quote Originally Posted by 2kaud View Post
    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

  5. #5
    Join Date
    Jul 2016
    Location
    Munich
    Posts
    4

    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.

  6. #6
    Join Date
    Jul 2016
    Location
    Munich
    Posts
    4

    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.

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    Re: Migrating code from VS2008 to VS2010

    Quote Originally Posted by 24plus7 View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)