Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1633

Getting a null terminated string::view_or_value may copy unnecessarily

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None

    Description

      string::view_or_value can be constructed from a const char*. This must be a null terminated string.

      The bsoncxx::string::view_or_value has a terminated method, which guarantees to return a view_or_value containing a null terminated representation of the string. This does not take into account the case where the view_or_value was constructed with a const char*, copying it when it really doesn't need to.

      We should add a boolean member to string::view_or_value to remember if it was constructed with a const char*, and if so, avoid copying when returning a null terminated view_or_value.

      Attachments

        Activity

          People

            kevin.albertson@mongodb.com Kevin Albertson
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: