Blame toonz/sources/include/tcg/boost/range_utility.h
|
Toshihiro Shimizu |
890ddd |
|
|
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 |
|
|
Toshihiro Shimizu |
890ddd |
namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
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>
|
|
Toshihiro Shimizu |
890ddd |
C &substitute(C &c, const Rng &rng)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
C(boost::begin(rng), boost::end(rng))
|
|
Toshihiro Shimizu |
890ddd |
.swap(c);
|
|
Toshihiro Shimizu |
890ddd |
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>
|
|
Toshihiro Shimizu |
890ddd |
C &insert2(C &c, const Rng &rng)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
c.insert(boost::begin(rng), boost::end(rng));
|
|
Toshihiro Shimizu |
890ddd |
return c;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // TCG_BOOST_RANGE_UTILITY_H
|