Lely core libraries 2.3.4
result.hpp File Reference

This header file is part of the utilities library; it contains a generic type that can represent both the result of a successful operation or the reason for failure. More...

#include <lely/util/error.hpp>
#include <type_traits>
#include <utility>
Include dependency graph for result.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  lely::util::detail::Success< T >
 
class  lely::util::detail::Success< void >
 
class  lely::util::detail::Failure< E >
 
struct  lely::util::detail::error_traits< int >
 
struct  lely::util::detail::error_traits<::std::error_code >
 
struct  lely::util::detail::error_traits<::std::exception_ptr >
 
class  lely::util::Result< T, E >
 A type capable of representing both the successful and failure result of an operation. More...
 
class  lely::util::Result< T, typename ::std::enable_if<!::std::is_void< T >::value >::type >
 
class  lely::util::Result< void, E >
 
class  lely::util::Result< void, void >
 

Functions

detail::Success< void > lely::util::success () noexcept
 Returns an object that can be used to implicitly construct a successful lely::util::Result with a default-constructed value.
 
template<class T >
detail::Success< typename ::std::decay< T >::type > lely::util::success (T &&t) noexcept
 Returns an object that can be used to implicitly construct a successful lely::util::Result with the specified value.
 
template<class E >
detail::Failure< typename ::std::decay< E >::type > lely::util::failure (E &&e) noexcept
 Returns an object that can be used to implicitly construct a failure lely::util::Result with the specified error.
 

Detailed Description

This header file is part of the utilities library; it contains a generic type that can represent both the result of a successful operation or the reason for failure.

lely::util::Result is a simplified version of the result type from the upcoming Boost.Outcome library.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file result.hpp.