Previous solution didn't correctly import the make_unique from
C++14/1z when using the new compiler. This ensures that OC::make_unique
will always work correctly.
Change-Id: Ibb7456f6375c5c16553bb76c71646ec911190c0f
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/299
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
/* The C++11 standard unfortunately forgot to provide make_unique<>! However, if we're
using C++14 or later, we want to take the standard library's implementation: */
-#if defined(__cplusplus) && __cplusplus < 201300
namespace OC {
+#if defined(__cplusplus) && __cplusplus < 201300
template<typename T, typename ...XS>
std::unique_ptr<T> make_unique(XS&& ...xs)
return std::unique_ptr<T>(new T(std::forward<XS>(xs)...));
}
-} // namespace OC
#else
using std::make_unique;
#endif
+} // namespace OC
namespace OC {
- using OC::make_unique;
-
/* Examine an OCStackResult, and either forward its value or raise an exception: */
OCStackResult result_guard(const OCStackResult r);