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

Use MNMLSTC for polyfills

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.1.0
    • Affects Version/s: None
    • Component/s: Portability
    • Labels:
      None

      • In C++11, you must use MNMLSTC.
      • In C++14, you can choose to use MNMLSTC or not.

      In both cases, you can choose to either use the system version of the library, or ours. For ours, we will obtain it with ExternalProjectAdd.

      Note that when using the embedded version of MNMLSTC, we will need to install the MNMLSTC headers to somewhere within our installed include directory, so as to not conflict with a potential system copy.

      This will require that we have a config.h header variable like LIBMONGOCXX_USING_PRIVATE_MNMLSTC, and then each polyfill header will need to look like:

      #include <mongocxx/driver/config.h>
      
      #if defined(LIBMONGOCXX_USING_MNMLSTC)
      #if defined(LIBMONGOCXX_USING_PRIVATE_MNMLSTC)
      #include <mongocxx/mnmlstc/foo.h>
      #else
      #include <core/foo.h>
      #endif
      
      namespace mongo {
      namespace stdx {
          using foo = ::mnmlstc::foo;
      } // namespace stdx
      } // namespace mongo
      
      #elif __cplusplus >= 201402L
      
      #include <foo>
      
      namespace mongo {
      namespace stdx {
          using foo = ::std::foo;
      } // namespace stdx
      } // namespace mongo
      
      #else
      #error Cannot find a polyfill for "foo"
      #endif
      

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: