bezier: add cbegin/cend/begin/end
This commit is contained in:
parent
191268d38b
commit
92be31d870
38
bezier.cpp
38
bezier.cpp
@ -392,8 +392,44 @@ util::bezier<S>::operator[] (size_t idx) const
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <size_t S>
|
||||
const util::point2f*
|
||||
util::bezier<S>::begin (void) const
|
||||
{
|
||||
return std::cbegin (m_points);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S>
|
||||
const util::point2f*
|
||||
util::bezier<S>::end (void) const
|
||||
{
|
||||
return std::cend (m_points);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S>
|
||||
const util::point2f*
|
||||
util::bezier<S>::cbegin (void) const
|
||||
{
|
||||
return std::cbegin (m_points);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S>
|
||||
const util::point2f*
|
||||
util::bezier<S>::cend (void) const
|
||||
{
|
||||
return std::cend (m_points);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <size_t S>
|
||||
std::ostream&
|
||||
util::operator<< (std::ostream &os, const bezier<S> &b)
|
||||
{
|
||||
@ -405,7 +441,7 @@ util::operator<< (std::ostream &os, const bezier<S> &b)
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INSTANTIATE(S) \
|
||||
template class util::bezier<S>; \
|
||||
template std::ostream& util::operator<< (std::ostream&, const bezier<S>&);
|
||||
|
@ -43,6 +43,11 @@ namespace util {
|
||||
point2f& operator[] (size_t idx);
|
||||
const point2f& operator[] (size_t idx) const;
|
||||
|
||||
const point2f* begin (void) const;
|
||||
const point2f* end (void) const;
|
||||
const point2f* cbegin (void) const;
|
||||
const point2f* cend (void) const;
|
||||
|
||||
private:
|
||||
// HACK: allow easy access to component-wise arithmetic using
|
||||
// vector2f rather than point2f in the implementation.
|
||||
|
Loading…
Reference in New Issue
Block a user