This is an example on how to use C++ classes to test machine endianity.
#include <iostream>
template<class IsEndian>
void print_endianity();
template<>
void print_endianity<boost::mpl::true_>() {
cout << "\nLittle Endian machine !!!\n" << endl;
}
template<>
void print_endianity<boost::mpl::false_>() {
cout << "\nBig Endian machine !!!\n" << endl;
}
int main() {
print_endianity<little_endian_machine::type>();
return EXIT_SUCCESS;
}