Issue with initializing a mongocxx::pool::entry

XMLWordPrintableJSON

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

      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
              Reporter:
              Puya Daravi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: