Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-29447

Transition away from Java-style `std::string toString() const` member functions

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Such a design creates numerous superfluous temporaries. Even with short-string optimizations, eventually the composition of such temporaries creates temporaries whose length exceeds that of of the short-string space. This starts to put undue pressure on the allocator.

      In C++ the right equivalent to `toString()` for output composition is the `std::ostream &operator << ( std::ostream &, const T & )` overload which is ADL-found at use. If temporary strings are needed, `std::stringstream` can be used. Additionally, `str::stream()` exists in our code base.

            Assignee:
            backlog-server-devtools DO NOT USE - Backlog - Dev Tools
            Reporter:
            adam.martin@mongodb.com ADAM Martin (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: