Could following code snippet be considered strategy pattern? Or it is something else? Or no pattern at all?
template <bool bigEndian>
void load(char * buf);
template <>
int load<false>(char * buf) { ... }
template <>
int load<true>(char * buf) { ... }
template <bool bigEndian>
class Loader {
...
// somewhere in code
int i = load<bigEndian>(buf);
...
}
Aucun commentaire:
Enregistrer un commentaire