[LLVMdev] set_intersect and Visual C compiler

Jeff Cohen jeffc at jolt-lang.org
Tue Oct 12 11:50:15 PDT 2004


> I think a better version is:
> 
> template <class S1Ty, class S2Ty>
> void set_intersect(S1Ty &S1, const S2Ty &S2) {
>    for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) {
>      const S1Ty::key_type &E = *I;
>      ++I;
>      if (!S2.count(E)) S1.erase(E);   // Erase element if not in S2
>    }
> }
> 
> This eliminates the use of a template templates while keeping the same
> flexibility.  Not that I actually to compile this...

The compiler probably wants a typename before S1Ty::key_type...




More information about the llvm-dev mailing list