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

    maxon::BaseArray allocation?

    SDK Help
    0
    3
    234
    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 21/05/2014 at 20:51, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R15 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Hello Forum,
      Is there a method to test if a maxon::BaseArray has been allocated.

      maxon::BaseArray<Int32> map;
      if (!map) return false; // does not compile
      

      Or is it safe to assume that the BaseArray is always allocated?

      Thanks for your help,

      Joe

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

        On 22/05/2014 at 00:06, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        <ADDRESS>
        User Information:
        Cinema 4D Version:   R15 
        Platform:   Windows  ;  
        Mac OSX  ; 
        Language(s) :    
        C++  ;

        ---------
        </ADDRESS> Hello Forum,
        Is there a method to test if a maxon::BaseArray has been allocated.

        [/DIV][DIV]maxon::BaseArray<Int32> map;[/DIV][DIV]if (!map) return false; // does not compile[/DIV][DIV]
        

        Or is it safe to assume that the BaseArray is always allocated?
        Thanks for your help,
        Joe

        You don't have to check this as the object is just created in the current scope, but no memory is allocated yet for the array.

        You've to check either
        - the return value of Append(), Insert() to see if the operation which triggered a memory allocation was successful
        - or the return value of Resize() which triggers memory allocations/releases too

        Best regards,

        Wilfried

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

          On 22/05/2014 at 00:26, xxxxxxxx wrote:

          Wilfried,

          You have answered my question.  I now see in the docs that BaseArray.Append() returns a pointer and BaseArray.Resize() returns Bool.

          Thank you,

          Joe

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