2
0
mirror of https://github.com/boostorg/hof.git synced 2026-01-31 20:22:11 +00:00

Add doc for infix

This commit is contained in:
Paul
2014-09-10 22:20:53 -04:00
parent 4972052a5e
commit 5fb07a506c
2 changed files with 41 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ extract fuse
extract identity
extract implicit
extract indirect
extract infix
extract invoke
extract is_callable
extract lambda

40
doc/src/infix.md Normal file
View File

@@ -0,0 +1,40 @@
infix
=====
Description
-----------
The `infix` function adaptor allows the function to be used as an infix
operator. The operator must be placed inside the angle brackets(ie `<`
and `>`).
Synopsis
--------
template<class F>
constexpr infix_adaptor<F> infix(F f);
Requirements
------------
F must be:
BinaryFunctionObject
MoveConstructible
Example
-------
struct plus_f
{
template<class T, class U>
T operator()(T x, U y) const
{
return x+y;
}
};
constexpr infix_adaptor<plus_f> plus = {};
int r = 3 <plus> 2;
assert(r, 5);