Skip to content

Instantly share code, notes, and snippets.

@imerr
Created November 8, 2015 07:48
Show Gist options
  • Save imerr/2e71eace7d9a25b740f3 to your computer and use it in GitHub Desktop.
Save imerr/2e71eace7d9a25b740f3 to your computer and use it in GitHub Desktop.
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <iostream>
struct TestThing {
int bla;
char blabla[10];
};
BOOST_FUSION_ADAPT_STRUCT(
TestThing,
bla,
blabla
);
struct FuncThing {
void operator() (int& bla) const {
std::cout << "Int" << std::endl;
}
// Wrong
void operator() (const char bla[10]) const {
std::cout << "Const Char [10]" << std::endl;
}
// should be correct though
void operator() (char bla[10]) const {
std::cout << "Char [10]" << std::endl;
}
};
int main () {
TestThing bla;
FuncThing f;
boost::fusion::for_each(bla, f);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment