diff options
| author | 2019-01-28 08:49:12 +0100 | |
|---|---|---|
| committer | 2019-02-06 16:54:25 -0800 | |
| commit | 1e99b1783d7f3b1e40724fc7af592626e9ecbf09 (patch) | |
| tree | 8577633f0590ad36aec6a668728821b850ce4e11 /libs/input/PointerController.cpp | |
| parent | 598a0ebac1a369b76cf319f4d32cc10fdd88ef8d (diff) | |
idmap2: introduce improved Result class
Add a new version of the Result class that functions like the old
Result, but in case of an error, also encodes a string detailing the
error. This will allow us to write the following type of code:
Result<Foo> CreateFoo() {
if (...) {
return Error("errno=%d", errno());
}
return Foo(...);
}
auto foo = CreateFoo();
if (!foo) {
std::cerr << "error: " << foo.GetErrorMessage() << std::endl;
abort();
}
std::cout << "foo=" << *foo << std::endl;
This commit only adds the new Result class. A later change will replace
uses of the old version.
Test: make idmap2_tests
Change-Id: I674d8a06866402adedf85f8514400f25840d5eda
Diffstat (limited to 'libs/input/PointerController.cpp')
0 files changed, 0 insertions, 0 deletions