So I wrote this code ->
#include <iostream>
#include <bitset>
int main(){
int num, temp, digits = 0;
std::cin >> num;
temp = num;
while(temp){
temp /= 10;
++digits;
}
const int size = digits;
std::bitset<size> a(num);
std::cout << a << std::endl;
return 0;
}
The bitset container isnt accepting the const integer size as a parameter and throwing an error -Non-type template argument is not a constant expression
. I want to know why this is happening as size has been declared as a constant and it's value isnt gonna change during the run-time of my program ?