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
41 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
42 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
44 public __gnu_debug::vector<T>
51 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
52 typedef __gnu_debug::vector<T> V;
54 typedef std::vector<T> V;
58 explicit Vector(
unsigned int sz,
const T &t = T()) : V(sz, t) {}
59 #if defined(_MSC_VER) && _MSC_VER == 1500
62 typename boost::disable_if<boost::is_integral<It> >::type *t=0) {
63 for (It it = b; it != e; ++it) {
68 explicit Vector(
const std::vector<VO> &o) {
70 for (std::vector<VO>::const_iterator it = o.begin();
71 it != o.end(); ++it) {
85 const T* data()
const {
98 explicit Vector(
const std::vector<VO> &o)
99 : V(o.begin(), o.end()) {}
107 V::insert(V::end(), o.begin(), o.end());
110 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
111 void show(std::ostream &out = std::cout)
const {
113 for (
unsigned int i = 0; i < V::size(); ++i) {
114 if (i > 0) out <<
", ";
124 std::ostringstream oss;
128 std::size_t __hash__()
const {
129 return boost::hash_range(V::begin(), V::end());
134 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
141 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
142 ret.insert(ret.end(), o.begin(), o.end());
148 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
150 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
151 return boost::hash_range(t.begin(), t.end());
155 IMPKERNEL_END_NAMESPACE
Helper functions for implementing hashes.
Helper class to aid in output of IMP classes to streams.
A more IMP-like version of the std::vector.
Base class 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.
Base class for a simple primitive-like type.
Helper class to aid in output of IMP classes to streams.