Michele De Stefano's C++ Utilities
test_traits.cpp

This is an example on how to use the following classes:

Shows also how to use the MDS_UTILS_ECHO_RESULT macro.

Author
Michele De Stefano
Date
25/05/2014
// test_traits.cpp
//
// Copyright (c) 2014 - Michele De Stefano (micdestefano@users.sourceforge.net)
//
// Distributed under the MIT License (See accompanying file LICENSE)
#include <iostream>
#include <mds_utils/echo.hpp>
struct A {
class A_tag {};
};
int main() {
std::cout << std::boolalpha;
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_vector<A>::value); // false
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_vector<boost::numeric::ublas::vector<double> >::value); // true
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_vector<boost::numeric::ublas::matrix<double> >::value); // false
std::cout << endl;
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_matrix<A>::value); // false
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_matrix<boost::numeric::ublas::matrix<double> >::value); // true
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_matrix<boost::numeric::ublas::compressed_matrix<double> >::value); // false
std::cout << endl;
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_compressed_matrix<A>::value); // false
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_compressed_matrix<boost::numeric::ublas::compressed_matrix<double> >::value); // true
MDS_UTILS_ECHO_RESULT(mds_utils::ublas::is_compressed_matrix<boost::numeric::ublas::matrix<double> >::value); // false
return EXIT_SUCCESS;
}