You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to use TL::Expected in a Qt project as Qt doesn't play well with exceptions and is quasi C++ version locked to 17.
I am probably missing something really obvious, but I expected the code below to compile.
#include <include/tl/expected.hpp>
class Parent
{
private:
int n =42;
};
class Child
{
public:
Child() = delete;
private:
Parent* myParent;
explicit Child(Parent *p = nullptr)
: myParent { p }
{};
};
int main()
{
// works
tl::expected<int, std::string> AnswerToUniverse{42};
Parent parent;
Parent* ptr{ &parent };
tl::expected<Child, std::string> child{parent};
return 0;
}
Instead I get
/TLExpected/main.cpp:33: error: no matching function for call to ‘tl::expected<Child, std::__cxx11::basic_string<char> >::expected(<brace-enclosed initializer list>)’
/TLExpected/build/Desktop-Debug/_deps/tl-expected-src/include/tl/expected.hpp:233:
error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
Probably not relevant but I am pulling in tl::expected using CPM in the project cmakefile
VERSION 1.1.0
GIT_REPOSITORY "https://github.com/TartanLlama/expected"
The text was updated successfully, but these errors were encountered:
Trying to use TL::Expected in a Qt project as Qt doesn't play well with exceptions and is quasi C++ version locked to 17.
I am probably missing something really obvious, but I expected the code below to compile.
Instead I get
Probably not relevant but I am pulling in tl::expected using CPM in the project cmakefile
VERSION 1.1.0
GIT_REPOSITORY "https://github.com/TartanLlama/expected"
The text was updated successfully, but these errors were encountered: