From 8574b999107154c52477fa6a28c3f31678fede93 Mon Sep 17 00:00:00 2001
From: Thomas Figueroa <splines21@outlook.com>
Date: Wed, 23 May 2018 11:22:48 -0500
Subject: [PATCH] Add check for C++17 to use std::optional (as opposed to
 boost::optional) Remove reference from Matches function. std::optional
 doesn't work with references

---
 include/core/optional.h   | 12 ++++++++++++
 include/tool/tool_event.h |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/core/optional.h b/include/core/optional.h
index 21b7bd30f..7a4cc5ab2 100644
--- a/include/core/optional.h
+++ b/include/core/optional.h
@@ -1,6 +1,8 @@
 # ifndef ___OPTIONAL_H___
 # define ___OPTIONAL_H___
 
+#if __cplusplus < 201703L
+
 #include <boost/optional.hpp>
 
 template<typename T>
@@ -8,4 +10,14 @@ using OPT = boost::optional<T>;
 
 const auto NULLOPT = boost::none;
 
+#else
+#include <optional>
+
+template<typename T>
+using OPT = std::optional<T>;
+
+constexpr auto NULLOPT = std::nullopt;
+
+#endif
+
 # endif //___OPTIONAL_HPP___
diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h
index f176db5f1..d19c59faa 100644
--- a/include/tool/tool_event.h
+++ b/include/tool/tool_event.h
@@ -495,13 +495,13 @@ public:
      */
     const std::string Format() const;
 
-    OPT<const TOOL_EVENT&> Matches( const TOOL_EVENT& aEvent ) const
+    OPT<const TOOL_EVENT> Matches( const TOOL_EVENT& aEvent ) const
     {
         for( const_iterator i = m_events.begin(); i != m_events.end(); ++i )
             if( i->Matches( aEvent ) )
                 return *i;
 
-        return OPT<const TOOL_EVENT&>();
+        return OPT<const TOOL_EVENT>();
     }
 
     /**
-- 
2.18.0.windows.1

