есть класс, с необходимой мне функцией:
class LinearAllocator : public Allocator<LinearAllocator>
{
public:
...
IAllocatable* allocate(std::size_t size, std::size_t alignment = 0); // CRTP
...
};
Также есть функция, которая должна примять параметром эту функцию:
char* readFile(const char* fullFileName, std::function<Memory::IAllocatable*(std::size_t, std::size_t)>) noexcept;
Пробую передать функцию следующим образом:
Memory::LinearAllocator allocator(32768);
char* buffer = Utils::readFile(name, std::bind(&Memory::LinearAllocator::allocate, &allocator));
В связи с этим я получаю следующую ошибку:
Error C2664 'char *Utils::readFile(const char *,std::function<Memory::IAllocatable *(size_t,size_t)>) noexcept': cannot convert argument 2 from 'std::_Binder<std::_Unforced,Memory::IAllocatable *(__thiscall Memory::LinearAllocator::* )(size_t,size_t) noexcept,Memory::LinearAllocator *>' to 'std::function<Memory::IAllocatable *(size_t,size_t)>'
Никак не могу понять в чем может быть проблема...