support memoryview construction from iterators

This commit is contained in:
Maxime Coste 2012-02-13 14:14:26 +00:00
parent 9304e41326
commit f541a639f2

View File

@ -25,6 +25,10 @@ public:
memoryview(const T* begin, const T* end) memoryview(const T* begin, const T* end)
: m_pointer(begin), m_size(end - begin) {} : m_pointer(begin), m_size(end - begin) {}
template<typename Iterator>
memoryview(const Iterator& begin, const Iterator& end)
: m_pointer(&(*begin)), m_size(end - begin) {}
memoryview(const std::vector<T>& v) memoryview(const std::vector<T>& v)
: m_pointer(&v[0]), m_size(v.size()) {} : m_pointer(&v[0]), m_size(v.size()) {}