/* * VectorSet.hpp * * Created on: Jun 2, 2010 * Author: crueger */ #ifndef VECTORSET_HPP_ #define VECTORSET_HPP_ #include #include /** * A simple mixin to give any STL conforming structure fast Vector abilities * * TODO: make this work for maps */ class Vector; // this tests, whether we actually have a Vector template struct is_vector{}; template <> struct is_vector{ typedef void wrong_type; }; template class VectorSet : public Set { // when our set carries something besides a vector this will produce an error typedef typename is_vector::wrong_type check_for_vector; public: // typedefs for STL conforming structure typedef typename Set::iterator iterator; typedef typename Set::const_iterator const_iterator; VectorSet(){} virtual ~VectorSet(){} /** * translate all Vectors within this set by a specified amount */ void translate(const Vector &translater){ // this is needed to allow template lookup transform(this->begin(),this->end(),this->begin(),bind1st(plus(),translater)); } }; #endif /* VECTORSET_HPP_ */