According to your suggestion,I tried to write:
 bind(static_cast<pair<IIPrimemap::iterator,bool>
                              (*)(const IIPrimemap::value_type&)>
                              (IIPrimemap::insert),
                              bind(&make_pair<int,int>,_1,constant(1)));
where
typedef std::map<int, int> IIPrimemap;
IIPrimemap primemapvec;
 
but the complier told me that:
 invalid static_cast from type `<unknown type>' to type `
   std::pair<std::_Rb_tree_iterator<std::pair<const int, int>, std::pair<const
   int, int>&, std::pair<const int, int>*>, bool> (*)(const std::pair<const
   int, int>&)'
Can you tell me why?
 Thanks.


在2009-07-02,"Steven Watanabe" <watanabesj@gmail.com> 写道:
>AMDG
>
>fmingu wrote:
>> Sorry for my unclearness. But how can I write the line:
>> bind(&std::pow,constant(-1.0),bind(&IIPrimemap::size,var(primemapvec)));
>> correctly and thus the program can be complied.
>> If not so the program can not be complied by Dev-C++ and I am confused about that.
>> I really want to know how to write the line correctly.
>> Please give me an example.
>
>As I have said, you need to cast &std::pow to a specific
>type of function pointer to resolve the ambiguity.
>I'll break this down further.
>a) You need to cast. I assume that you know how
>casts in C++ work. If not, look up static_cast
>in your favorite elementary C++ text.
>b) You need to know the function pointer type to cast to.
>Do you know what a function pointer type looks like?
>It's similar to a function declaration.
><return type> (*)(<argument types>)
>for example, given the declaration
>int foo(char);
>the type of &foo is int(*)(char).
>Since there are several overloads of std::pow,
>you need to pick the one that is most appropriate.
>
>In Christ,
>Steven Watanabe
>



200万种商品,最低价格,疯狂诱惑你