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) {
79 explicit Vector(
const std::vector<VO> &o)
80 : V(o.begin(), o.end()) {}
88 V::insert(V::end(), o.begin(), o.end());
91 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
92 void show(std::ostream &out = std::cout)
const {
94 for (
unsigned int i = 0; i < V::size(); ++i) {
95 if (i > 0) out <<
", ";
105 std::ostringstream oss;
109 std::size_t __hash__()
const {
110 return boost::hash_range(V::begin(), V::end());
115 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
122 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
123 ret.insert(ret.end(), o.begin(), o.end());
129 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
131 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
132 return boost::hash_range(t.begin(), t.end());
136 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.