Commit a5e264cb authored by Davis King's avatar Davis King

Added check for initializer list support so code compiles in visual studio.

parent 87e04764
...@@ -31,12 +31,20 @@ ...@@ -31,12 +31,20 @@
# if __has_feature(cxx_rvalue_references) # if __has_feature(cxx_rvalue_references)
# define DLIB_HAS_RVALUE_REFERENCES # define DLIB_HAS_RVALUE_REFERENCES
# endif # endif
# if __has_feature(cxx_generalized_initializers)
# define DLIB_HAS_INITIALIZER_LISTS
# endif
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define DLIB_HAS_RVALUE_REFERENCES # define DLIB_HAS_RVALUE_REFERENCES
# define DLIB_HAS_INITIALIZER_LISTS
#elif defined(_MSC_VER) && _MSC_VER >= 1600 #elif defined(_MSC_VER) && _MSC_VER >= 1600
# define DLIB_HAS_RVALUE_REFERENCES # define DLIB_HAS_RVALUE_REFERENCES
#elif defined(_MSC_VER) && _MSC_VER >= 1800
# define DLIB_HAS_INITIALIZER_LISTS
# define DLIB_HAS_RVALUE_REFERENCES
#elif defined(__INTEL_COMPILER) && defined(BOOST_INTEL_STDCXX0X) #elif defined(__INTEL_COMPILER) && defined(BOOST_INTEL_STDCXX0X)
# define DLIB_HAS_RVALUE_REFERENCES # define DLIB_HAS_RVALUE_REFERENCES
# define DLIB_HAS_INITIALIZER_LISTS
#endif #endif
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "matrix_assign_fwd.h" #include "matrix_assign_fwd.h"
#include "matrix_op.h" #include "matrix_op.h"
#include <utility> #include <utility>
#ifdef DLIB_HAS_RVALUE_REFERENCES #ifdef DLIB_HAS_INITIALIZER_LISTS
#include <initializer_list> #include <initializer_list>
#endif #endif
...@@ -1114,7 +1114,7 @@ namespace dlib ...@@ -1114,7 +1114,7 @@ namespace dlib
matrix_assign(*this, m); matrix_assign(*this, m);
} }
#ifdef DLIB_HAS_RVALUE_REFERENCES #ifdef DLIB_HAS_INITIALIZER_LISTS
matrix(const std::initializer_list<T>& l) matrix(const std::initializer_list<T>& l)
{ {
if (NR*NC != 0) if (NR*NC != 0)
...@@ -1169,7 +1169,9 @@ namespace dlib ...@@ -1169,7 +1169,9 @@ namespace dlib
temp.swap(*this); temp.swap(*this);
return *this; return *this;
} }
#endif // DLIB_HAS_INITIALIZER_LISTS
#ifdef DLIB_HAS_RVALUE_REFERENCES
matrix(matrix&& item) matrix(matrix&& item)
{ {
#ifdef MATLAB_MEX_FILE #ifdef MATLAB_MEX_FILE
...@@ -1210,7 +1212,7 @@ namespace dlib ...@@ -1210,7 +1212,7 @@ namespace dlib
#endif #endif
return *this; return *this;
} }
#endif #endif // DLIB_HAS_RVALUE_REFERENCES
template <typename U, size_t len> template <typename U, size_t len>
explicit matrix ( explicit matrix (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment