Made the AttributeItem nullptr_t enabled only for direct conversions
authorErich Keane <erich.keane@intel.com>
Tue, 8 Sep 2015 22:03:46 +0000 (15:03 -0700)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 9 Sep 2015 05:31:15 +0000 (05:31 +0000)
This will fix the GCC5.0 and CLANG 3.5 and newer compile issues.

Change-Id: Ib9c6b69c29e4c6ac70f0d04a2c791a60eae004f9
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2414
Reviewed-by: Kevron Rees <tripzero.kev@gmail.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/include/OCRepresentation.h

index 73d85c4..1beafa1 100644 (file)
@@ -264,7 +264,7 @@ namespace OC
                     // Enable-if required to prevent conversions to alternate types.  This prevents
                     // ambigious conversions in the case where conversions can include a number of
                     // types, such as the string constructor.
-                    template<typename T, typename= typename std::enable_if<
+                    template<typename T, typename std::enable_if<
                      std::is_same<T, int>::value ||
                      std::is_same<T, double>::value ||
                      std::is_same<T, bool>::value ||
@@ -285,14 +285,18 @@ namespace OC
                      std::is_same<T, std::vector<OCRepresentation>>::value ||
                      std::is_same<T, std::vector<std::vector<OCRepresentation>>>::value ||
                      std::is_same<T, std::vector<std::vector<std::vector<OCRepresentation>>>>::value
-                     >::type // enable_if
+                     , int>::type = 0// enable_if
                     >
                     operator T() const
                     {
                         return this->getValue<T>();
                     }
 
-                    operator std::nullptr_t() const
+                    template<typename T, typename std::enable_if<
+                        std::is_same<T, std::nullptr_t>::value
+                        , int>::type = 0
+                    >
+                    operator T() const
                     {
                         this->getValue<NullType>();
                         return nullptr;