Commit 39fe9862 authored by Davis King's avatar Davis King

Added an is_std_vector to the is_kind.h file.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402500
parent 0aae9097
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#ifndef DLIB_IS_KINd_H_ #ifndef DLIB_IS_KINd_H_
#define DLIB_IS_KINd_H_ #define DLIB_IS_KINd_H_
#include <vector>
namespace dlib namespace dlib
{ {
/*! /*!
...@@ -54,6 +56,31 @@ namespace dlib ...@@ -54,6 +56,31 @@ namespace dlib
!*/ !*/
}; };
// ----------------------------------------------------------------------------------------
template <typename T>
struct is_std_vector : public default_is_kind_value
{
/*!
- if (T is an implementation of the standard C++ std::vector object) then
- is_std_vector<T>::value == true
- else
- is_std_vector<T>::value == false
!*/
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// Implementation details
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <typename T, typename alloc>
struct is_std_vector<std::vector<T,alloc> > { const static bool value = true; };
template <typename T> struct is_std_vector<T&> { const static bool value = is_std_vector<T>::value; };
template <typename T> struct is_std_vector<const T&>{ const static bool value = is_std_vector<T>::value; };
template <typename T> struct is_std_vector<const T> { const static bool value = is_std_vector<T>::value; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "../assert.h" #include "../assert.h"
#include "std_vector_c_abstract.h" #include "std_vector_c_abstract.h"
#include "../serialize.h" #include "../serialize.h"
#include "../is_kind.h"
namespace dlib namespace dlib
{ {
...@@ -338,6 +339,11 @@ namespace dlib ...@@ -338,6 +339,11 @@ namespace dlib
{ throw serialization_error(e.info + "\n while deserializing object of type std_vector_c"); } { throw serialization_error(e.info + "\n while deserializing object of type std_vector_c"); }
} }
// ----------------------------------------------------------------------------------------
template <typename T, typename alloc>
struct is_std_vector<std_vector_c<T,alloc> > { const static bool value = true; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
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