mirror of
https://github.com/boostorg/lambda2.git
synced 2025-05-10 01:33:53 +00:00
Update documentation
This commit is contained in:
parent
0572e42219
commit
2ff3fef3d1
@ -9,6 +9,7 @@ Peter Dimov
|
||||
:toc: left
|
||||
:toclevels: 4
|
||||
:idprefix:
|
||||
:listing-caption: Code Example
|
||||
:docinfo: private-footer
|
||||
|
||||
:leveloffset: +1
|
||||
|
@ -13,3 +13,4 @@ https://www.boost.org/LICENSE_1_0.txt
|
||||
* Added special cases in `operator<<` and `operator>>` when
|
||||
the first argument is a stream, to allow `std::cout << _1`.
|
||||
* Added `operator\->*`.
|
||||
* Added `first`, `second`.
|
||||
|
@ -90,6 +90,11 @@ template<class A, class B> auto operator>>=( A && a, B && b );
|
||||
|
||||
template<class A, class B> auto operator->*( A && a, B && b );
|
||||
|
||||
// projections
|
||||
|
||||
inline constexpr /unspecified/ first{};
|
||||
inline constexpr /unspecified/ second{};
|
||||
|
||||
} // namespace lambda2
|
||||
} // namespace boost
|
||||
```
|
||||
@ -405,3 +410,26 @@ Returns: :: `std::bind( std::forward<B>(b), std::forward<A>(a) );`
|
||||
Notes: :: This operator is intended to be used with "projection" function
|
||||
objects such as member pointers or member functions taking zero arguments,
|
||||
as in `_1\->*&X::m` or `_1\->*&X::f`.
|
||||
|
||||
### Projections
|
||||
|
||||
```
|
||||
inline constexpr /unspecified/ first{};
|
||||
```
|
||||
|
||||
A function object such that `first(x)` returns `std::get<0>(x)`.
|
||||
|
||||
```
|
||||
inline constexpr /unspecified/ second{};
|
||||
```
|
||||
|
||||
A function object such that `second(x)` returns `std::get<1>(x)`.
|
||||
|
||||
.Using first and second to print out a map
|
||||
```
|
||||
void print( std::map<int, std::string> const & m )
|
||||
{
|
||||
using namespace boost::lambda2;
|
||||
std::for_each( m.begin(), m.end(), std::cout << _1->*first << ": " << _1->*second << '\n' );
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user