Refactor T and V flag macros to play nice with STL generics