유형 생성자 :평범한 포인터가 일반적인 연산 인 &와 *와 함께 모나드입니까?
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;
'단위'가 좌변 치 참조를 사용하지 않으면 변수 모자에 대한 포인터가 더 이상 존재하지 않습니다. – NathanOliver
'unit = std :: addressof'? 타입 생성자 ='std :: add_pointer_t'? –
'template T *;가 무엇입니까? –
aschepler