9 #ifndef IMPKERNEL_CONVERTIBLE_VECTOR_H
10 #define IMPKERNEL_CONVERTIBLE_VECTOR_H
11 #include <IMP/kernel_config.h>
18 #if defined(_MSC_VER) && _MSC_VER == 1500
19 # include <boost/type_traits.hpp>
20 # include <boost/utility.hpp>
23 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
24 #include <debug/vector>
29 IMPKERNEL_BEGIN_NAMESPACE
40 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
41 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
43 public __gnu_debug::vector<T>
50 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
51 typedef __gnu_debug::vector<T> V;
53 typedef std::vector<T> V;
57 explicit Vector(
unsigned int sz,
const T &t = T()) : V(sz, t) {}
58 #if defined(_MSC_VER) && _MSC_VER == 1500
61 typename boost::disable_if<boost::is_integral<It> >::type *t=0) {
62 for (It it = b; it != e; ++it) {
67 explicit Vector(
const std::vector<VO> &o) {
69 for (std::vector<VO>::const_iterator it = o.begin();
70 it != o.end(); ++it) {
84 const T* data()
const {
97 explicit Vector(
const std::vector<VO> &o)
98 : V(o.begin(), o.end()) {}
106 V::insert(V::end(), o.begin(), o.end());
109 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
110 void show(std::ostream &out = std::cout)
const {
112 for (
unsigned int i = 0; i < V::size(); ++i) {
113 if (i > 0) out <<
", ";
123 std::ostringstream oss;
127 std::size_t __hash__()
const {
128 return boost::hash_range(V::begin(), V::end());
133 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
140 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
141 ret.insert(ret.end(), o.begin(), o.end());
147 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
149 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
150 return boost::hash_range(t.begin(), t.end());
154 IMPKERNEL_END_NAMESPACE
A more IMP-like version of the std::vector.
Base for a simple primitive-like type.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.