Skip to content

Commit

Permalink
Make some anyhow functions inline (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed May 24, 2022
1 parent 921a21b commit ec7f22a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/mitama/anyhow/error.hpp
Expand Up @@ -119,16 +119,16 @@ namespace mitama::anyhow {
template<class E> cause(E) -> cause<std::decay_t<E>>;

template<class E>
auto anyhow(E &&err) -> std::shared_ptr<mitama::anyhow::error> {
inline auto anyhow(E &&err) -> std::shared_ptr<mitama::anyhow::error> {
return std::make_shared<mitama::anyhow::cause<std::decay_t<E>>>(std::forward<E>(err));
}

std::ostream& operator<<(std::ostream& os, std::shared_ptr<::mitama::anyhow::error> const & err) {
inline std::ostream& operator<<(std::ostream& os, std::shared_ptr<::mitama::anyhow::error> const & err) {
return os << err->what();
}

template <class Err, class ...Args>
auto failure(Args&&... args)
inline auto failure(Args&&... args)
-> std::enable_if_t<std::is_base_of_v<mitama::anyhow::error, Err>, mitama::failure_t<std::shared_ptr<Err>>>
{ return mitama::failure(std::make_shared<Err>(std::forward<Args>(args)...)); }
}
Expand Down

0 comments on commit ec7f22a

Please sign in to comment.