9 #ifndef IMPKERNEL_CONVERTIBLE_VECTOR_H
10 #define IMPKERNEL_CONVERTIBLE_VECTOR_H
11 #include <IMP/kernel_config.h>
16 #include <boost/serialization/access.hpp>
17 #include <boost/serialization/split_member.hpp>
20 #if defined(_MSC_VER) && _MSC_VER == 1500
21 # include <boost/type_traits.hpp>
22 # include <boost/utility.hpp>
25 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
26 #include <debug/vector>
31 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 friend class boost::serialization::access;
62 template<
class Archive>
void save(Archive &ar,
const unsigned int)
const {
63 size_t sz = V::size();
71 template<
class Archive>
void load(Archive &ar,
const unsigned int) {
81 BOOST_SERIALIZATION_SPLIT_MEMBER()
86 explicit Vector(
unsigned int sz,
const T &t = T()) : V(sz, t) {}
87 #if defined(_MSC_VER) && _MSC_VER == 1500
90 typename boost::disable_if<boost::is_integral<It> >::type *t=0) {
91 for (It it = b; it != e; ++it) {
96 explicit Vector(
const std::vector<VO> &o) {
98 for (std::vector<VO>::const_iterator it = o.begin();
99 it != o.end(); ++it) {
108 explicit Vector(
const std::vector<VO> &o)
109 : V(o.begin(), o.end()) {}
117 V::insert(V::end(), o.begin(), o.end());
120 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
121 void show(std::ostream &out = std::cout)
const {
123 for (
unsigned int i = 0; i < V::size(); ++i) {
124 if (i > 0) out <<
", ";
134 std::ostringstream oss;
138 std::size_t __hash__()
const {
139 return boost::hash_range(V::begin(), V::end());
144 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
151 inline Vector<T> operator+(Vector<T> ret,
const Vector<T> &o) {
152 ret.insert(ret.end(), o.begin(), o.end());
158 #if IMP_COMPILER_HAS_DEBUG_VECTOR &&IMP_HAS_CHECKS >= IMP_INTERNAL
160 inline std::size_t hash_value(
const __gnu_debug::vector<T> &t) {
161 return boost::hash_range(t.begin(), t.end());
165 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.