Use C++17 optional and any

The optional and any types are no longer experimental
in C++17.

Change-Id: I0b507b73fdd13afe531bef7a2ce308ebc8a3da7d
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/manager.cpp b/manager.cpp
index 3d9850d..5e05342 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -109,7 +109,7 @@
 }
 
 void Manager::addInterface(const std::string& objectPath, InterfaceType type,
-                           std::experimental::any& object)
+                           std::any& object)
 {
     auto id = getEntryID(objectPath);
     auto entry = entries.find(id);
@@ -127,8 +127,7 @@
 }
 
 void Manager::addChildInterface(const std::string& objectPath,
-                                InterfaceType type,
-                                std::experimental::any& object)
+                                InterfaceType type, std::any& object)
 {
     auto id = getEntryID(objectPath);
     auto entry = childEntries.find(id);
@@ -173,7 +172,7 @@
 
     object->emit_object_added();
 
-    std::experimental::any anyObject = object;
+    std::any anyObject = object;
 
     addInterface(objectPath, InterfaceType::POLICY, anyObject);
 }
@@ -247,7 +246,7 @@
             }
             object->serialize(dir);
 
-            std::experimental::any anyObject = object;
+            std::any anyObject = object;
             addChildInterface(objectPath, InterfaceType::CALLOUT, anyObject);
             calloutNum++;
         }
@@ -289,7 +288,7 @@
         if (callout->deserialize(saveDir))
         {
             callout->emit_object_added();
-            std::experimental::any anyObject = callout;
+            std::any anyObject = callout;
             addChildInterface(objectPath, InterfaceType::CALLOUT, anyObject);
         }
     }
diff --git a/manager.hpp b/manager.hpp
index e340d90..b0446b6 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -5,7 +5,7 @@
 #include "dbus.hpp"
 #include "interfaces.hpp"
 
-#include <experimental/any>
+#include <any>
 #include <experimental/filesystem>
 #include <map>
 #include <sdbusplus/bus.hpp>
@@ -46,10 +46,10 @@
 
   private:
     using EntryID = uint32_t;
-    using InterfaceMap = std::map<InterfaceType, std::experimental::any>;
+    using InterfaceMap = std::map<InterfaceType, std::any>;
     using EntryMap = std::map<EntryID, InterfaceMap>;
 
-    using ObjectList = std::vector<std::experimental::any>;
+    using ObjectList = std::vector<std::any>;
     using InterfaceMapMulti = std::map<InterfaceType, ObjectList>;
     using EntryMapMulti = std::map<EntryID, InterfaceMapMulti>;
 
@@ -231,7 +231,7 @@
      * @param[in] object - the interface object
      */
     void addInterface(const std::string& objectPath, InterfaceType type,
-                      std::experimental::any& object);
+                      std::any& object);
 
     /**
      * Adds an interface to a child object, which is an object that
@@ -246,7 +246,7 @@
      * @param[in] object - the interface object
      */
     void addChildInterface(const std::string& objectPath, InterfaceType type,
-                           std::experimental::any& object);
+                           std::any& object);
 
     /**
      * The sdbusplus bus object
diff --git a/policy_find.cpp b/policy_find.cpp
index f785823..5771100 100644
--- a/policy_find.cpp
+++ b/policy_find.cpp
@@ -27,8 +27,6 @@
 
 static constexpr auto HOST_EVENT = "org.open_power.Host.Error.Event";
 
-namespace optional_ns = std::experimental;
-
 /**
  * Returns a property value from a map of properties.
  *
@@ -39,8 +37,8 @@
  * @return optional<T> - the property value
  */
 template <typename T>
-optional_ns::optional<T> getProperty(const DbusPropertyMap& properties,
-                                     const std::string& name)
+std::optional<T> getProperty(const DbusPropertyMap& properties,
+                             const std::string& name)
 {
     auto prop = properties.find(name);
 
@@ -63,7 +61,7 @@
  *
  * @return optional<std::string> - the data value. Will not be empty if found.
  */
-optional_ns::optional<std::string>
+std::optional<std::string>
     getAdditionalDataItem(const std::vector<std::string>& additionalData,
                           const std::string& name)
 {
@@ -104,7 +102,7 @@
  *
  * @return optional<std::string> - the severity string as listed above
  */
-optional_ns::optional<std::string> getESELSeverity(const std::string& data)
+std::optional<std::string> getESELSeverity(const std::string& data)
 {
     // The User Header section starts at byte 48, and take into account
     // the input data is a space separated string representation of HEX data.
@@ -240,7 +238,7 @@
     static const std::vector<std::string> ADFields{"CALLOUT_INVENTORY_PATH",
                                                    "RAIL_NAME", "INPUT_NAME"};
 
-    optional_ns::optional<std::string> mod;
+    std::optional<std::string> mod;
     for (const auto& field : ADFields)
     {
         mod = getAdditionalDataItem(*data, field);
diff --git a/policy_table.hpp b/policy_table.hpp
index a2e7346..d6bf307 100644
--- a/policy_table.hpp
+++ b/policy_table.hpp
@@ -2,8 +2,8 @@
 
 #include "config.h"
 
-#include <experimental/optional>
 #include <map>
+#include <optional>
 #include <vector>
 
 namespace ibm
@@ -26,11 +26,9 @@
     std::string ceid;
 };
 
-namespace optional_ns = std::experimental;
-
 using DetailsList = std::vector<Details>;
 using DetailsReference = std::reference_wrapper<const Details>;
-using FindResult = optional_ns::optional<DetailsReference>;
+using FindResult = std::optional<DetailsReference>;
 
 using PolicyMap = std::map<std::string, DetailsList>;