Added an is_std_vector to the is_kind.h file.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402500
This commit is contained in:
Davis King 2008-09-06 15:53:33 +00:00
parent 0aae909742
commit 39fe986296
2 changed files with 33 additions and 0 deletions

View File

@ -3,6 +3,8 @@
#ifndef DLIB_IS_KINd_H_
#define DLIB_IS_KINd_H_
#include <vector>
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; };
// ----------------------------------------------------------------------------------------
}

View File

@ -8,6 +8,7 @@
#include "../assert.h"
#include "std_vector_c_abstract.h"
#include "../serialize.h"
#include "../is_kind.h"
namespace dlib
{
@ -338,6 +339,11 @@ namespace dlib
{ 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; };
// ----------------------------------------------------------------------------------------
}