Made the std_vector_c able to copy directly from std::vector objects.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402902
This commit is contained in:
Davis King 2009-03-07 16:05:50 +00:00
parent ad64c286ff
commit 3f7abc834b
2 changed files with 23 additions and 1 deletions

View File

@ -48,7 +48,7 @@ namespace dlib
const Allocator& alloc= Allocator()) : impl(first,last,alloc) {} const Allocator& alloc= Allocator()) : impl(first,last,alloc) {}
std_vector_c(const std_vector_c<T,Allocator>& x) : impl(x.impl) {} std_vector_c(const std_vector_c<T,Allocator>& x) : impl(x.impl) {}
std_vector_c(const std::vector<T,Allocator>& x) : impl(x) {}
std_vector_c<T,Allocator>& operator=(const std_vector_c<T,Allocator>& x) std_vector_c<T,Allocator>& operator=(const std_vector_c<T,Allocator>& x)
{ {
@ -56,6 +56,12 @@ namespace dlib
return *this; return *this;
} }
std_vector_c<T,Allocator>& operator=(const std::vector<T,Allocator>& x)
{
impl = x;
return *this;
}
template <typename InputIterator> template <typename InputIterator>
void assign(InputIterator first, InputIterator last) { impl.assign(first,last); } void assign(InputIterator first, InputIterator last) { impl.assign(first,last); }
void assign(size_type n, const T& u) { impl.assign(n,u); } void assign(size_type n, const T& u) { impl.assign(n,u); }

View File

@ -83,6 +83,13 @@ namespace dlib
- #*this == x - #*this == x
!*/ !*/
std_vector_c(
const std::vector<T,Allocator>& x
);
/*!
ensures
- #*this == x
!*/
std_vector_c<T,Allocator>& operator= ( std_vector_c<T,Allocator>& operator= (
const std_vector_c<T,Allocator>& x const std_vector_c<T,Allocator>& x
@ -93,6 +100,15 @@ namespace dlib
- returns #*this - returns #*this
!*/ !*/
std_vector_c<T,Allocator>& operator= (
const std::vector<T,Allocator>& x
);
/*!
ensures
- #*this == x
- returns #*this
!*/
template <typename InputIterator> template <typename InputIterator>
void assign( void assign(
InputIterator first, InputIterator first,