I am trying to use std::set for arbitrary-length integer vectors defined from the NTL-Library and for some reason it doesn't work. It works totally fine with the ZZ integers defined by the library:
#include <NTL/ZZ.h>
#include <NTL/vec_ZZ.h>
#include <set>
NTL_CLIENT
int main(void){
std::set<ZZ> foo;
foo.insert(to_ZZ(1)); //works without problems
std::set<vec_ZZ> vectorFoo;
vec_ZZ vec;
vectorFoo.insert(vec); //causes compiler to crash
return 0;
}
Does anyone know why the first insertion works and the second doesn't?
std::set<T>
is ordered bystd::less<T>
, which defaults tobool operator<(T,T)
.ZZ
does define a properoperator<
(they're ordered) butvec_ZZ
doesn't. In fact, most NTL classes don't, not evenZZ_p
. Thereforestd::set<ZZ_p>
is equally invalid.