2

I have a template class "HEADER_FILE" that has a variable bitset<>

using std::bitset<REG_SIZE>;
using std::bitset<REG_SIZE_2>;

template <int regSize=REG_SIZE>class Foo{
    bitset<regSize> bits;
};

i cannot use

using namespace std;

in header file which however is not giving any errors.

error: template_id cannot appear in a using statement.

where am i going wrong ;

Ashish Negi
  • 5,193
  • 8
  • 51
  • 95

1 Answers1

5

Use

using std::bitset;

instead. Even better, change to:

template <int regSize=REG_SIZE>class Foo{
    std::bitset<regSize> bits;
};

because polluting the global scope in headers is not a kind thing to do.

Yakov Galka
  • 70,775
  • 16
  • 139
  • 220