• Mark Isaacson's avatar
    Add make_array to folly · 1fb83fbc
    Mark Isaacson authored
    Summary: This function is being proposed in WG21, the C++ standards body for inclusion in the STL via the Library Fundamentals v2 TS. Using the normal constructor for a std::array with an initializer list introduces a source of coupling between the # of elements you put in the initializer list and the size of the array you specify as a template argument. Worse still, if you put less things in the initializer list than the template argument specifies, it doesn't warn you that you've probably made a pretty devious and subtle error. With this function your array size will always be the same as the # of things you actually put in it. What's more, in some cases this can deduce the type of the elements as well.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D3164432
    
    fb-gh-sync-id: beceaae2ee01cd5f93dec86cf36efdb78a28b4a3
    fbshipit-source-id: beceaae2ee01cd5f93dec86cf36efdb78a28b4a3
    1fb83fbc
Traits.h 17.2 KB