Using boost::bind with boost::function: retrieve binded variable type

后端 未结 4 700
自闭症患者
自闭症患者 2020-12-21 04:14

Is there any way to retrieve information on what paramaters were bounded by boost::bind or does this need to be stored manually?

i.e.:

in .h

         


        
4条回答
  •  醉话见心
    2020-12-21 04:58

    boost::function has some public typedefs which you should be able to use.

    template  // Function type R (T1, T2, ..., TN)
    class function : public functionN {
    public:
      // types
      typedef R  result_type;         
      typedef T1 argument_type;         // If N == 1
      typedef T1 first_argument_type;   // If N == 2
      typedef T2 second_argument_type;  // If N == 2
      typedef T1 arg1_type;           
      typedef T2 arg2_type;  
    
      // ...
    
      // static constants
      static const int arity = N;
    

    Adapted slightly from the boost::function reference.

提交回复
热议问题