Pregunta

He estado experimentando con la biblioteca de impulso :: function_types recientemente, y me he encontrado con un poco de un inconveniente. Quiero averiguar la convención de llamada de una función dada, sin embargo no estoy muy seguro de cómo hacer esto. Esto es lo que tengo hasta ahora:

Esto produce un error acerca de la forma en que no puede encontrar los valores de las variables * _cc dentro de cada sentencia if. Sospecho que puede tener algo que ver con la forma en que estoy definiendo las macros; la documentación no es muy clara acerca de cómo configurar extra de convenciones de llamada con su compilador ... Cualquier ayuda aquí sería apreciada.

Gracias,

EDITADO: tengo trabajo, parece como que tenía que incluir config / config.hpp, como a continuación:

#define BOOST_FT_COMMON_X86_CCs 1
#include <boost/function_types/config/config.hpp>
#include <boost/type_traits.hpp>
#include <boost/function_types/property_tags.hpp>
#include <boost/function_types/is_function.hpp>
#include <boost/function_types/is_function_pointer.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/function_types/function_arity.hpp>

template<class F>
inline void parse_cc(F f, func_info_s& out) {
    out.cc = cc_err;
    if (boost::function_types::is_function<F, stdcall_cc>::value == true) {
        out.cc = cc_stdcall;
    } else if (boost::function_types::is_function<F, fastcall_cc>::value == true) {
        out.cc = cc_fastcall;
    } else if (boost::function_types::is_function<F, cdecl_cc>::value == true) {
        out.cc = cc_cdecl;
    }
}
¿Fue útil?

Solución

Parece como si estuviera simplemente perdiendo uno de los archivos de cabecera (config / config.hpp)

#define BOOST_FT_COMMON_X86_CCs 1
#include <boost/function_types/config/config.hpp>
#include <boost/type_traits.hpp>
#include <boost/function_types/property_tags.hpp>
#include <boost/function_types/is_function.hpp>
#include <boost/function_types/is_function_pointer.hpp>
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/function_types/function_arity.hpp>

template<class F>
inline void parse_cc(F f, func_info_s& out) {
    out.cc = cc_err;
    if (boost::function_types::is_function<F, stdcall_cc>::value == true) {
        out.cc = cc_stdcall;
    } else if (boost::function_types::is_function<F, fastcall_cc>::value == true) {
        out.cc = cc_fastcall;
    } else if (boost::function_types::is_function<F, cdecl_cc>::value == true) {
        out.cc = cc_cdecl;
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top