9 #ifndef IMPBASE_CONVERTIBLE_VECTOR_H
10 #define IMPBASE_CONVERTIBLE_VECTOR_H
11 #include <IMP/base/base_config.h>
18 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
19 #include <debug/vector>
24 IMPBASE_BEGIN_NAMESPACE
38 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
39 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
41 public __gnu_debug::vector<T>
48 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
49 typedef __gnu_debug::vector<T> V;
51 typedef std::vector<T> V;
55 explicit Vector(
unsigned int sz,
const T &t = T()) : V(sz, t) {}
60 explicit Vector(
const std::vector<VO> &o)
61 : V(o.begin(), o.end()) {}
68 V::insert(V::end(), o.begin(), o.end());
71 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
72 void show(std::ostream &out = std::cout)
const {
74 for (
unsigned int i = 0; i < V::size(); ++i) {
75 if (i > 0) out <<
", ";
85 std::ostringstream oss;
89 std::size_t __hash__()
const {
90 return boost::hash_range(V::begin(), V::end());
95 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
102 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
103 ret.insert(ret.end(), o.begin(), o.end());
109 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
111 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
112 return boost::hash_range(t.begin(), t.end());
116 IMPBASE_END_NAMESPACE
Base for a simple primitive-like type.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.