Blame toonz/sources/include/tcg/boost/range_utility.h
|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TCG_BOOST_RANGE_UTILITY_H
|
|
Toshihiro Shimizu |
890ddd |
#define TCG_BOOST_RANGE_UTILITY_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// boost includes
|
|
Toshihiro Shimizu |
890ddd |
#include <boost range.hpp=""></boost>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\file range_utility.h
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\brief Contains utilities to be used with Boost.Range objects.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace tcg {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//***************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Range utilities
|
|
Toshihiro Shimizu |
890ddd |
//***************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Substitutes a container's content with the one inside
|
|
Toshihiro Shimizu |
890ddd |
a \a Boost range.
|
|
Toshihiro Shimizu |
890ddd |
\details The container type requires construction with an
|
|
Toshihiro Shimizu |
890ddd |
iterator pair and the swap() method.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename c,="" rng="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
C &substitute(C &c, const Rng &rng) {
|
|
Shinya Kitaoka |
120a6e |
C(boost::begin(rng), boost::end(rng)).swap(c);
|
|
Shinya Kitaoka |
120a6e |
return c;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief Inserts a range inside an associative container.
|
|
Toshihiro Shimizu |
890ddd |
\details The container type requires an insert() method
|
|
Toshihiro Shimizu |
890ddd |
accepting a pair of iterators.
|
|
Toshihiro Shimizu |
890ddd |
\note For insertion in a sequential container, use
|
|
Toshihiro Shimizu |
890ddd |
<tt>boost::insert</tt>.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename c,="" rng="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
C &insert2(C &c, const Rng &rng) {
|
|
Shinya Kitaoka |
120a6e |
c.insert(boost::begin(rng), boost::end(rng));
|
|
Shinya Kitaoka |
120a6e |
return c;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} // namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // TCG_BOOST_RANGE_UTILITY_H
|