-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
593 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "optional.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/*---------------------------------------------------------------------\ | ||
| ____ _ __ __ ___ | | ||
| |__ / \ / / . \ . \ | | ||
| / / \ V /| _/ _/ | | ||
| / /__ | | | | | | | | ||
| /_____||_| |_| |_| | | ||
| | | ||
----------------------------------------------------------------------/ | ||
* | ||
* This file contains private API, this might break at any time between releases. | ||
* You have been warned! | ||
*/ | ||
|
||
#ifndef ZYPP_ZYPPNG_PIPELINES_OPERATORS_H | ||
#define ZYPP_ZYPPNG_PIPELINES_OPERATORS_H | ||
|
||
#include <utility> | ||
|
||
namespace zyppng { | ||
|
||
namespace detail { | ||
template <typename Callback> | ||
struct and_then_helper { | ||
Callback function; | ||
|
||
template< typename T > | ||
auto operator()( T&& exp ) { | ||
return and_then( std::forward<T>(exp), function ); | ||
} | ||
}; | ||
|
||
template <typename Callback> | ||
struct or_else_helper { | ||
Callback function; | ||
|
||
template< typename T > | ||
auto operator()(T&& exp ) { | ||
return or_else( std::forward<T>(exp), function ); | ||
} | ||
}; | ||
|
||
template <typename Callback> | ||
struct inspect_helper { | ||
Callback function; | ||
|
||
template< typename T> | ||
auto operator()( T &&exp ) { | ||
return inspect( std::forward<T>(exp), function ); | ||
} | ||
}; | ||
|
||
template <typename Callback> | ||
struct inspect_err_helper { | ||
Callback function; | ||
|
||
template< typename T> | ||
auto operator()( T &&exp ) { | ||
return inspect_err( std::forward<T>(exp), function ); | ||
} | ||
}; | ||
} | ||
|
||
|
||
namespace operators { | ||
template <typename Fun> | ||
auto inspect ( Fun && function ) { | ||
return detail::inspect_helper<Fun> { | ||
std::forward<Fun>(function) | ||
}; | ||
} | ||
|
||
template <typename Fun> | ||
auto inspect_err ( Fun && function ) { | ||
return detail::inspect_err_helper<Fun> { | ||
std::forward<Fun>(function) | ||
}; | ||
} | ||
|
||
template <typename Fun> | ||
auto and_then ( Fun && function ) { | ||
return detail::and_then_helper<Fun> { | ||
std::forward<Fun>(function) | ||
}; | ||
} | ||
|
||
template <typename Fun> | ||
auto or_else ( Fun && function ) { | ||
return detail::or_else_helper<Fun> { | ||
std::forward<Fun>(function) | ||
}; | ||
} | ||
} | ||
|
||
} | ||
|
||
#endif |
Oops, something went wrong.