Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 1 | [/ |
| 2 | Copyright 2010 Neil Groves |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | /] |
| 6 | [section:strided strided] |
| 7 | |
| 8 | [table |
| 9 | [[Syntax] [Code]] |
| 10 | [[Pipe] [`rng | boost::adaptors::strided(n)`]] |
| 11 | [[Function] [`boost::adaptors::stride(rng, n)`]] |
| 12 | ] |
| 13 | |
| 14 | * [*Precondition:] `0 <= n`. |
| 15 | * [*Returns:] A new range based on `rng` where traversal is performed in steps of `n`. |
| 16 | * [*Range Category:] __single_pass_range__ |
| 17 | * [*Returned Range Category:] The range category of `rng`. |
| 18 | |
| 19 | [section:strided_example strided example] |
| 20 | [import ../../../test/adaptor_test/strided_example.cpp] |
| 21 | [strided_example] |
| 22 | [endsect] |
| 23 | |
| 24 | This would produce the output: |
| 25 | `` |
| 26 | 1,3,5,7,9, |
| 27 | `` |
| 28 | [endsect] |
| 29 | |
| 30 | |