Created
July 29, 2015 19:55
-
-
Save mach-kernel/342d15e410171e0bc01e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <boost/fusion/include/adapt_struct.hpp> | |
#include <boost/fusion/include/size.hpp> | |
#include <boost/preprocessor/repetition/repeat.hpp> | |
struct MyStruct | |
{ | |
int x; | |
int y; | |
}; | |
BOOST_FUSION_ADAPT_STRUCT( | |
MyStruct, | |
(int, x) | |
(int, y) | |
); | |
int main() | |
{ | |
#ifndef PRINT | |
#define PRINT(unused, number, data) \ | |
std::cout << number << std::endl; | |
#endif | |
MyStruct s; | |
std::cout << boost::fusion::size(s) << std::endl; | |
//line below works - it iterate and write output | |
BOOST_PP_REPEAT(2, PRINT, "here I will pass my data") | |
//this won't compile | |
BOOST_PP_REPEAT(boost::fusion::size(s), PRINT, "here i will pass my data") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment