M
Michal Sekletar
Hello,
I am programming NetFlow collector and in module dealing with sorting ip
addresses into classes according do predefined rules I want to create
std::bitset to represent network mask. I have a method
void foo(struct in_addr addr, const size_t len).
I want to create bit set in this method std::bitset<len> b; but compiler
is complaining :
trie.cpp:22:17: error: ‘len’ cannot appear in a constant-expression
trie.cpp:22:20: error: template argument 1 is invalid.
It is fine to create bitset like this std::bitset<24> b; on the other
hand if I pass net mask length as an argument compilation ends up with
an error.
So, am I forgetting something important about std::bitset template class?
Thanks
I am programming NetFlow collector and in module dealing with sorting ip
addresses into classes according do predefined rules I want to create
std::bitset to represent network mask. I have a method
void foo(struct in_addr addr, const size_t len).
I want to create bit set in this method std::bitset<len> b; but compiler
is complaining :
trie.cpp:22:17: error: ‘len’ cannot appear in a constant-expression
trie.cpp:22:20: error: template argument 1 is invalid.
It is fine to create bitset like this std::bitset<24> b; on the other
hand if I pass net mask length as an argument compilation ends up with
an error.
So, am I forgetting something important about std::bitset template class?
Thanks