eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.22k stars 170 forks source link

complied error when mock with unique_ptr #287

Closed zhlongfj closed 1 year ago

zhlongfj commented 1 year ago

My Code: Mock schedulerCoreMock; auto schedulerCore = unique_ptr(&schedulerCoreMock.get(), {});

Complied Error:

: cannot be converted from "initializer list" to "std::unique_ptr>"
FranckRJ commented 1 year ago

This is unrelated to this library, it's just a misuse of the STL. Try with another class like std::string instead of fakeit::Mock and you'll have the same error. Check the documentation to know how unique_ptr works : https://en.cppreference.com/w/cpp/memory/unique_ptr

malcolmdavey commented 1 year ago

@zhlongfj Has this one been resolved?

FranckRJ commented 1 year ago

I'll close this issue because I guess it was resolved.