$OpenBSD: patch-include_aqsis_tex_io_texfileheader_h,v 1.1 2018/04/22 09:06:06 rsadowski Exp $

Index: include/aqsis/tex/io/texfileheader.h
--- include/aqsis/tex/io/texfileheader.h.orig
+++ include/aqsis/tex/io/texfileheader.h
@@ -43,6 +43,9 @@
 
 #include <iostream>
 #include <map>
+#if __cplusplus >= 201103L
+#include <typeindex>
+#endif
 
 #include <boost/any.hpp>
 #include <boost/shared_ptr.hpp>
@@ -74,9 +77,13 @@ namespace Aqsis {
 class CqTexFileHeader
 {
 	private:
+#if __cplusplus < 201103L
 		class CqTypeInfoHolder;
 		/// Underlying map type.
 		typedef std::map<CqTypeInfoHolder, boost::any> TqAttributeMap;
+#else
+		typedef std::map<std::type_index, boost::any> TqAttributeMap;
+#endif
 		typedef TqAttributeMap::const_iterator const_iterator;
 	public:
 
@@ -180,6 +187,7 @@ class CqTexFileHeader
 };
 
 
+#if __cplusplus < 201103L
 //==============================================================================
 // Implementation details
 //==============================================================================
@@ -200,6 +208,7 @@ class CqTexFileHeader::CqTypeInfoHolder
 			return m_typeInfo.before(rhs.m_typeInfo) != 0;
 		}
 };
+#endif
 
 //------------------------------------------------------------------------------
 // CqTexFileHeader
@@ -261,13 +270,21 @@ inline void CqTexFileHeader::setTimestamp()
 template<typename AttrTagType>
 inline void CqTexFileHeader::set(const typename AttrTagType::type& value)
 {
+#if __cplusplus < 201103L
 	m_attributeMap[CqTypeInfoHolder(typeid(AttrTagType))] = value;
+#else
+	m_attributeMap[std::type_index(typeid(AttrTagType))] = value;
+#endif
 }
 
 template<typename AttrTagType>
 void CqTexFileHeader::erase()
 {
+#if __cplusplus < 201103L
 	m_attributeMap.erase(CqTypeInfoHolder(typeid(AttrTagType)));
+#else
+	m_attributeMap.erase(std::type_index(typeid(AttrTagType)));
+#endif
 }
 
 template<typename AttrTagType>
@@ -280,7 +297,11 @@ inline typename AttrTagType::type& CqTexFileHeader::fi
 template<typename AttrTagType>
 inline const typename AttrTagType::type& CqTexFileHeader::find() const
 {
+#if __cplusplus < 201103L
 	const_iterator iter = m_attributeMap.find(CqTypeInfoHolder(typeid(AttrTagType)));
+#else
+	const_iterator iter = m_attributeMap.find(std::type_index(typeid(AttrTagType)));
+#endif
 	if(iter == m_attributeMap.end())
 	{
 		AQSIS_THROW_XQERROR(XqInternal, EqE_BadFile, "Requested attribute \""
@@ -310,7 +331,11 @@ inline typename AttrTagType::type* CqTexFileHeader::fi
 template<typename AttrTagType>
 inline const typename AttrTagType::type* CqTexFileHeader::findPtr() const
 {
+#if __cplusplus < 201103L
 	const_iterator iter = m_attributeMap.find(CqTypeInfoHolder(typeid(AttrTagType)));
+#else
+	const_iterator iter = m_attributeMap.find(std::type_index(typeid(AttrTagType)));
+#endif
 	if(iter == m_attributeMap.end())
 		return 0;
 	return & boost::any_cast<const typename AttrTagType::type&>(iter->second);
