error: B2 does not name a type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <bitset>

using namespace std;

#define old_bitset_declarator(uint, name, value) bitset<uint> name(value)

#define wrapped_bitset(uint,name,value) bitset leftbracket uint rightbracket \ name leftparenthesis value rightparenthesis;
#define lparenthesis (
#define rparenthesis )
#define leftbracket <
#define rightbracket >

int main()
{
    wrapped_bitset(4, B2, 2);
}


Also get error:

expected unqualified id before string constant

when changed name to # name
and:

parse error in template argument list

when changed to ##name
and
 
pasting "rightbracket" and ""B2"" does not give a valid preprocessing token

when changed to ## #name


edit: the code was supposed to look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[code]
#include <iostream>
#include <bitset>

using namespace std;

#define old_bitset_declarator(uint, name, value) bitset<uint> name(value)

#define wrapped_bitset(uint,name,value) bitset leftbracket uint rightbracket name leftparenthesis value rightparenthesis;
#define lparenthesis (
#define rparenthesis )
#define leftbracket <
#define rightbracket >

int main()
{
    wrapped_bitset(4, B2, 2);
}
Last edited on
bump
bump bump
Topic archived. No new replies allowed.