SigUtil  0.95
Utility modules for modern C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
maybe.hpp File Reference

HaskellのData.Maybeの機能を模倣した関数と、boost.optionalのためのユーティリティ関数 More...

Go to the source code of this file.

Namespaces

 sig
 

Typedefs

template<class T >
using sig::Maybe = boost::optional< T >
 

Functions

template<class T , class R = typename sig::impl::remove_const_reference<T>::type>
Maybe< R > sig::Just (T &&v)
 値コンストラクタ More...
 
template<class T >
Maybe< T > sig::Just (T const &v)
 
template<class T = void>
auto sig::Nothing () -> typename impl::SameIf< T, void, typename boost::none_t, Maybe< T >>::type
 値コンストラクタ More...
 
template<class T >
auto sig::Nothing (T const &dummy) -> Maybe< T >
 値コンストラクタ More...
 
template<class T >
bool sig::isJust (Maybe< T > const &m)
 Justであるか調べる関数.Maybe a -> Bool. More...
 
constexpr bool sig::isJust (boost::none_t m)
 
template<class T >
bool sig::isNothing (Maybe< T > const &m)
 Nothingであるか調べる関数.Maybe a -> Bool. More...
 
constexpr bool sig::isNothing (boost::none_t m)
 
template<class T >
T & sig::fromJust (Maybe< T > &m)
 Justから値を取り出す関数.Maybe a -> a. More...
 
template<class T >
T const & sig::fromJust (Maybe< T > const &m)
 
template<class T >
T && sig::fromJust (Maybe< T > &&m)
 
template<class T >
T & sig::operator* (Maybe< T > &m)
 fromJust演算子 More...
 
template<class T >
T const & sig::operator* (Maybe< T > const &m)
 
template<class T >
T && sig::operator* (Maybe< T > &&m)
 
template<class T >
T & sig::fromMaybe (T &def, Maybe< T > &m)
 Maybeから値を取り出す関数.もしNothingなら引数のデフォルト値を返す.a -> Maybe a -> a. More...
 
template<class T >
T const & sig::fromMaybe (T const &def, Maybe< T > const &m)
 
template<class T >
T && sig::fromMaybe (T &&def, Maybe< T > &&m)
 
template<class T >
T && sig::fromMaybe (T &&def, boost::none_t m)
 
template<class F , class C >
auto sig::mapMaybe (F const &f, C const &list) -> typename impl::container_traits< C >::template rebind< typename std::remove_reference< decltype(*(impl::eval(f, std::declval< typename impl::container_traits< C >::value_type >())))>::type >
 Maybeを返す関数を指定するfilter関数.(a -> Maybe b) -> [a] -> [b]. More...
 
template<class T , class F >
auto sig::operator>>= (Maybe< T > const &m, F const &f) -> decltype(impl::eval(f, std::declval< T >()))
 Haskell風のbind演算子. Maybe m => m a -> (a -> m b) -> m b. More...
 
template<class F , class T >
auto sig::operator<<= (F const &f, Maybe< T > const &m) -> decltype(impl::eval(f, std::declval< T >()))
 C++に合わせたbind演算子. Maybe m => (a -> m b) -> m a -> m b. More...
 
template<class T1 , class T2 >
auto sig::operator<<= (Maybe< T1 > &m, T2 const &v) -> Maybe< T1 > &
 Maybeオブジェクトへの再代入を行う演算子 More...
 

Detailed Description

HaskellのData.Maybeの機能を模倣した関数と、boost.optionalのためのユーティリティ関数

Definition in file maybe.hpp.