Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <progrock/cppx/macro/nargs.h> // CPPX_NARGS, CPPX_CONCAT
- #include <progrock/cppx/macro/invoke.h> // CPPX_INVOKE
- #include <iostream>
- using namespace std;
- #define NUMBER_( x ) x
- #define NUMBER_1( a ) \
- NUMBER_( a )
- #define NUMBER_2( a, b ) \
- CPPX_CONCAT( NUMBER_1( a ), NUMBER_( b ) )
- #define NUMBER_3( a, b, c ) \
- CPPX_CONCAT( NUMBER_2( a, b ), NUMBER_( c ) )
- #define NUMBER_4( a, b, c, d ) \
- CPPX_CONCAT( NUMBER_3( a, b, c ), NUMBER_( d ) )
- #define NUMBER_5( a, b, c, d, e ) \
- CPPX_CONCAT( NUMBER_4( a, b, c, d ), NUMBER_( e ) )
- #define NUMBER( ... ) \
- CPPX_INVOKE( CPPX_CONCAT( NUMBER_, CPPX_NARGS( __VA_ARGS__ ) ), ( __VA_ARGS__ ) )
- int main()
- {
- wcout << NUMBER( 123,456,789 ) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement