I can't figure out how to make a writable transform_iterator work.
Here is what I have:
#include
#include
#include <vector>
template< int N >
struct Get
{
template<typename T>
struct result;
template
struct result
{
typedef typename boost::reference_wrapper::type>::type type;
};
template<typename Tup>
typename result::type operator()(Tup& t)
{
return boost::tuples::get<N>(t);
}
};
int main()
{
std::vector > v1;
v1.push_back(boost::make_tuple(1,2.2f));
v1.push_back(boost::make_tuple(2,3.2f));
std::vector > v2(2);
std::copy(boost::make_transform_iterator(v1.begin(),Get<0>()),
boost::make_transform_iterator(v1.end(),Get<0>()),
boost::make_transform_iterator(v2.begin(),Get<0>()));
}
g++ seems to get hung up on figuring out the result type of Get<0>.
Any help would be greatly appreciated.
Chris