I have a boost::makevariantover. How can I convert that to a vector . Any samples will be helpful using boost::apply_visitor
class pixel_visitor
: public boost::static_visitor<>
{
public:
template <typename T>
void operator() (const ome::compat::shared_ptr<PixelBuffer<T> >& v)
{
std::cout << std::real(v);
}
};
pixelBuffer test= buf.vbuffer();
test.apply_visitor(&pixel_visitor());
where
typedef boost::make_variant_over<pixel_buffer_types>::type pixelBuffer;
We don't know what your pixelbuffer types are.
Regardless, if you know how to convert those to vectors, you could simply return that from the visitor's call operator:
class pixel_visitor
: public boost::static_visitor<std::vector<WhatEverYouWant> >
{
public:
template <typename T>
result_type operator() (const ome::compat::shared_ptr<PixelBuffer<T> >& v)
{
std::vector<WhatEverYouWant> result;
// do your conversion here
return result;
}
};
So you can e.g.
std::vector<WhatEverYouWant> applied;
applied = boost_apply_visitor(pixel_visitor(), test);