Vector Class Discussion

Factoring out boilerplate for integer vectors
Author:  Date: 2016-05-31 23:57
I'm considering factoring out a lot of the boilerplate that's repeated for Vec16c, Vec8s, etc. Either with templates, or with CPP macros like
#define BOILERPLATE_ASSIGNMENTS(V_T)					\
/* vector operator += : add */					        \
static inline V_T & operator += (V_T & a, V_T const & b) {	        \
    a = a + b;								\
    return a;								\
}									\
/* vector operator -= : sub */						\
static inline V_T & operator -= (V_T & a, V_T const & b) {		\
    a = a - b;								\
    return a;								\
}									\
...

Either way might make users of the library get worse error messages, but I suspect that the template way would be even worse than with macros.

Did you purposely avoid factoring out functions that are just defined in terms of other functions, and are the same except for the type names? Or is that something you'd like to see done, but didn't have time for?

 
thread Test suite for VCL? And how to submit patches new - Peter Cordes - 2016-05-31
replythread Test suite for VCL? And how to submit patches new - Agner - 2016-05-31
replythread Factoring out boilerplate for integer vectors - Peter Cordes - 2016-05-31
last reply Factoring out boilerplate for integer vectors new - Agner - 2016-06-01
last reply Test suite for VCL? And how to submit patches new - Peter Cordes - 2016-06-05
last replythread Test suite for VCL? And how to submit patches new - Peter Cordes - 2016-06-02
last replythread Test suite for VCL? And how to submit patches new - Agner - 2016-06-03
last reply Test suite for VCL? And how to submit patches new - Peter Cordes - 2016-06-03