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

Issue with initializing a mongocxx::pool::entry

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

      Hello. `mongocxx::pool::entry` is designed to mimic `unique_ptr`. However it is created by a factory and therefor cannot be default constructed with a `nullptr` like how you would normally do with a `unique_ptr`.

      This creates an awkward situation where you have to wrap the `entry` inside another unique_ptr to be able to separate declaration and definition (i.e. when using it as a class member). This means that you would need to have code that looks like this
      `(**entry).list_databases():`

      or
      `(*entry)->list_databases():`

      Adding an extra level of indirection as well as being hard to read.

      I think the entry either should not mimic a `unique_ptr`, or if it does, then like a `unique_ptr` you should be able to default construct an invalid entry from a `nullptr` and move construct later on from what the pool factory gives you.

            Assignee:
            Unassigned Unassigned
            Reporter:
            puya@motionmetrics.com Puya Daravi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: