型コンストラクタ:Tへプレーンポインタは、通常の操作&と*と一緒にモナドですか?
template< typename T > T*;
ユニットオペレータ
template< typename T > T* unit(T /*or T&*/ t) { return &t; }
バインドオペレータ
template< typename A, typename B >
B* bind(A a, std::function<b*(a)> f)
{ return a ? f(a) : nullptr; }
モナドの法律
bind(unit(x), f) === f(x)
bind(bind(x, f1), f2) === auto a = f1(x); auto b = f2(a); return b;
'unit'が左辺値参照を取らない場合、変数ハットへのポインタはもう存在しません。 – NathanOliver
'unit = std :: addressof'?型コンストラクタ= 'std :: add_pointer_t'? –
'templateとは何ですか? –
aschepler