/*******************************************************************************
*
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
*
* Copyright (C) 2011-2013 by M. Ferrero, O. Parcollet
*
* TRIQS is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* TRIQS. If not, see .
*
******************************************************************************/
#ifndef TRIQS_TOOLS_MC_IMPL_TOOLS_H
#define TRIQS_TOOLS_MC_IMPL_TOOLS_H
#include
#include
#include
namespace triqs { namespace mc_tools {
template struct has_h5_read : std::false_type {};
template struct has_h5_read(), std::string(), std::declval()))> : std::true_type {};
template struct has_h5_write : std::false_type {};
template struct has_h5_write(), std::string(), std::declval()))> : std::true_type {};
typedef std::function h5_rw_lambda_t;
// given a pointer to an object, synthesize h5_read/write function for this object
template h5_rw_lambda_t make_h5_write_impl(T * p, std::true_type) {
return [p](h5::group F, std::string const &Name) {h5_write(F,Name, *p);};
}
template h5_rw_lambda_t make_h5_read_impl(T * p, std::true_type) {
return [p](h5::group F, std::string const &Name) {h5_read(F,Name, *p);};
}
template h5_rw_lambda_t make_h5_read_impl (T * p, std::false_type) { return h5_rw_lambda_t();}
template h5_rw_lambda_t make_h5_write_impl(T * p, std::false_type) { return h5_rw_lambda_t();}
template h5_rw_lambda_t make_h5_write(T * p) { return make_h5_write_impl(p,std::integral_constant::value>());}
template h5_rw_lambda_t make_h5_read (T * p) { return make_h5_read_impl (p,std::integral_constant::value>());}
// move_construtible is not in gcc 4.6 std lib
template
struct is_move_constructible : std::is_constructible::type> {};
}}// end namespace
#endif