-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
I know that your library is reported to work on mingw52
on mingw 4.8 ,__cplusplus = 201103 but it seem like REF_QUALIFIER feature is not supported
this naive patch fixed compilation error for me for optional-lite version 3.1.1
Index: optional.hpp
===================================================================
--- optional.hpp (version 3.1.1)
+++ optional.hpp (fix have ref)
@@ -254,6 +254,7 @@
# define optional_COMPILER_GNUC_VERSION 0
#endif
+
#if defined(__clang__)
# define optional_COMPILER_CLANG_VERSION optional_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
#else
@@ -345,7 +346,7 @@
# define optional_nullptr NULL
#endif
-#if optional_HAVE( REF_QUALIFIER )
+#if optional_HAVE( REF_QUALIFIER ) && ( !optional_COMPILER_GNUC_VERSION || optional_COMPILER_GNUC_VERSION >= 490 )
# define optional_ref_qual &
# define optional_refref_qual &&
#else
@@ -718,7 +719,7 @@
{
return as<value_type>();
}
-
+#if optional_HAVE( REF_QUALIFIER ) && ( !optional_COMPILER_GNUC_VERSION || optional_COMPILER_GNUC_VERSION >= 490 )
value_type const & value() const optional_ref_qual
{
return * value_ptr();
@@ -742,7 +743,18 @@
}
#endif
+#else
+ value_type const & value() const
+ {
+ return * value_ptr();
+ }
+ value_type & value()
+ {
+ return * value_ptr();
+ }
+#endif
+
#if optional_CPP11_OR_GREATER
using aligned_storage_t = typename std::aligned_storage< sizeof(value_type), alignof(value_type) >::type;
best regards.
Metadata
Metadata
Assignees
Labels
No labels