Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    const Vec to Vec

    SDK Help
    0
    4
    410
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 09/06/2013 at 05:07, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R14 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi Folks,

      I'm in need of a little c++ lesson here - how do I convert from a const Vector * to a Vector *? Example of what I've tried below:

        
      from:   
      const Vector *CVec = Vector(100,100,100);   
      to   
      Vector *NewVec;   
      NewVec = CVec; // doesn't seem to work..   
      

      Regards,

      WP.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 09/06/2013 at 06:11, xxxxxxxx wrote:

        hi, I am a C++ beginner, so I have no idea if this is what you are after, but here is something I myself use:

        vector<LONG>* vLong = new vector<LONG>();
        

        Hope this helps

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 09/06/2013 at 06:13, xxxxxxxx wrote:

          Use a const_cast with pointers:

          Vector* NewVec = const_cast<Vector*>(CVec);
          

          Still, if you don't require CVec to be const (immutable) you should define it as such and avoid the conundrum altogether.  You could also make a new vector and copy the pointed contents from the constant to it so that the 'contents' become mutable.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 09/06/2013 at 10:48, xxxxxxxx wrote:

            Thanks to Both of you. I may have finally found a part-solution to a 12+ month problem of mine!

            Cheers,

            WP.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post