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
43 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
44 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
46 public __gnu_debug::vector<T>
53 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
54 typedef __gnu_debug::vector<T> V;
56 typedef std::vector<T> V;
60 explicit Vector(
unsigned int sz,
const T &t = T()) : V(sz, t) {}
61 #if defined(_MSC_VER) && _MSC_VER == 1500
64 typename boost::disable_if<boost::is_integral<It> >::type *t=0) {
65 for (It it = b; it != e; ++it) {
70 explicit Vector(
const std::vector<VO> &o) {
72 for (std::vector<VO>::const_iterator it = o.begin();
73 it != o.end(); ++it) {
82 explicit Vector(
const std::vector<VO> &o)
83 : V(o.begin(), o.end()) {}
91 V::insert(V::end(), o.begin(), o.end());
94 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
95 void show(std::ostream &out = std::cout)
const {
97 for (
unsigned int i = 0; i < V::size(); ++i) {
98 if (i > 0) out <<
", ";
108 std::ostringstream oss;
112 std::size_t __hash__()
const {
113 return boost::hash_range(V::begin(), V::end());
118 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
125 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
126 ret.insert(ret.end(), o.begin(), o.end());
132 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
134 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
135 return boost::hash_range(t.begin(), t.end());
139 IMPKERNEL_END_NAMESPACE
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.