Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-3157

[C++] Improve buffer creation for typed data

    XMLWordPrintableJSON

Details

    Description

      While looking into https://github.com/apache/arrow/pull/2481, I noticed this pattern:

      const uint8_t* bytes_array = reinterpret_cast<const uint8_t*>(input);
      auto buffer = std::make_shared<Buffer>(bytes_array, sizeof(float)*input_length);

      It's not the end of the world but seems a little verbose to me. It would be great to have something like this:

      auto buffer = MakeBuffer<float>(input, input_length);

      I couldn't find it, does it already exist somewhere? Any thoughts on the API? Potentially specializations to make a buffer out of a std::vector<T> would also be helpful.

       

      Attachments

        Issue Links

          Activity

            People

              wesm Wes McKinney
              pcmoritz Philipp Moritz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m