TransformedSequence.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_TransformedSequence_h_
#define polybori_TransformedSequence_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include <polybori/iterators/TransformedIterator.h>
#include <vector>
#include <algorithm>
BEGIN_NAMESPACE_PBORI
template <class SequenceType, class OperatorType>
class TransformedSequence {
public:
typedef SequenceType sequence_type;
typedef typename sequence_type::const_iterator sequence_iterator;
typedef OperatorType operator_type;
typedef TransformedIterator<sequence_iterator, operator_type> const_iterator;
TransformedSequence(const sequence_type& seq, const operator_type& func):
m_sequence(seq), m_func(func) {
}
const_iterator begin() const {
return const_iterator(m_sequence.begin(), m_func); }
const_iterator end() const {
return const_iterator(m_sequence.end(), m_func); }
private:
sequence_type m_sequence;
operator_type m_func;
};
END_NAMESPACE_PBORI
#endif /* polybori_TransformedSequence_h_ */