Boost logo

Boost :

Subject: Re: [boost] Interest in multi-dimensional array class templates.
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-06-25 14:49:29


On 06/24/11 20:29, Brian Smith wrote:
> If you're program uses a relatively large number of static arrays all
> in scope at the same time or if a few relatively large static arrays
> are in scope the stack checker crashes the program when its run, the
> heap allocated arrays can be present in greater numbers or used when
> relatively large arrays are required.

If stack space is limited, then why not just allocate the static
array on the heap with something like:

         typedef
       int
     elem_t
     ;
         typedef
       bounds3<2,3,4>
     bounds_t
     ;
         typedef
      array
      < elem_t
      , bounds_t
      , true
      , null::allocator
>::type
    array_static_t
    ;
      array_static_t*
    p_static=new array_static_t;

? You would then have only 1 call to any allocator
instead of 3 and save space on the heap besides.

-regards,
Larry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk