Added explicit to constructors
parent
2194762f11
commit
43bae4dc2f
|
@ -35,9 +35,7 @@ namespace gtsam {
|
||||||
template<typename VALUE>
|
template<typename VALUE>
|
||||||
class FastVector: public std::vector<VALUE,
|
class FastVector: public std::vector<VALUE,
|
||||||
typename internal::FastDefaultVectorAllocator<VALUE>::type> {
|
typename internal::FastDefaultVectorAllocator<VALUE>::type> {
|
||||||
|
public:
|
||||||
public:
|
|
||||||
|
|
||||||
typedef std::vector<VALUE,
|
typedef std::vector<VALUE,
|
||||||
typename internal::FastDefaultVectorAllocator<VALUE>::type> Base;
|
typename internal::FastDefaultVectorAllocator<VALUE>::type> Base;
|
||||||
|
|
||||||
|
@ -66,13 +64,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor from the base class */
|
/** Copy constructor from the base class */
|
||||||
FastVector(const Base& x) :
|
explicit FastVector(const Base& x) :
|
||||||
Base(x) {
|
Base(x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor from a standard STL container */
|
/** Copy constructor from a standard STL container */
|
||||||
template<typename ALLOCATOR>
|
template<typename ALLOCATOR>
|
||||||
FastVector(const std::vector<VALUE, ALLOCATOR>& x) {
|
explicit FastVector(const std::vector<VALUE, ALLOCATOR>& x) {
|
||||||
// This if statement works around a bug in boost pool allocator and/or
|
// This if statement works around a bug in boost pool allocator and/or
|
||||||
// STL vector where if the size is zero, the pool allocator will allocate
|
// STL vector where if the size is zero, the pool allocator will allocate
|
||||||
// huge amounts of memory.
|
// huge amounts of memory.
|
||||||
|
@ -85,14 +83,12 @@ public:
|
||||||
return std::vector<VALUE>(this->begin(), this->end());
|
return std::vector<VALUE>(this->begin(), this->end());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
template<class ARCHIVE>
|
template<class ARCHIVE>
|
||||||
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
|
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
|
||||||
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
|
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
} // namespace gtsam
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue