Loki::Function
Hi group!
I read the FunctionTest.cpp in /test directory and see this:
struct X
{
X(int x);
int plus(int x);
};
// ...
X one(1);
Loki::Function<int (int)> f2(&one,&X::plus);
It works fine and so I write some similar code for std::vector<int> as
follows:
vector<int> primTable;
Function< size_t () > p_size(&primTable, &vector<int>::size ); //
O.K.
Function< vector<int>::reference (size_t)> p_ref(&primTable,
&vector<int>::at); // generate compile error
Error:
error: no matching function for call to 'Loki::Function<int& ()
(size_t)>::Function(std::vector<int, std::allocator<int> >*,
<unresolved overloaded function type>)'
/home/yangacer/NameDB/loki/include/loki/Function.h:156: note:
candidates are: Loki::Function<R ()(P01)>::Function(int) [with R =
int&, P01 = size_t]
/home/yangacer/NameDB/loki/include/loki/Function.h:156: note:
Loki::Function<R ()(P01)>::Function(const Loki::Function<R ()(P01)>&)
[with R = int&, P01 = size_t]
/home/yangacer/NameDB/loki/include/loki/Function.h:156: note:
Loki::Function<R ()(P01)>::Function() [with R = int&, P01 = size_t]
Is this a known issue or I miss-understood something?
Thanks for your time :-)
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]