tokenized.qbk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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:tokenized tokenized]
  7. [table
  8. [[Syntax] [Code]]
  9. [
  10. [Pipe]
  11. [
  12. ``
  13. rng | boost::adaptors::tokenized(regex)
  14. rng | boost::adaptors::tokenized(regex, i)
  15. rng | boost::adaptors::tokenized(regex, rndRng)
  16. rng | boost::adaptors::tokenized(regex, i, flags)
  17. rng | boost::adaptors::tokenized(regex, rndRng, flags)
  18. ``
  19. ]
  20. ]
  21. [
  22. [Function]
  23. [
  24. ``
  25. boost::adaptors::tokenize(rng, regex)
  26. boost::adaptors::tokenize(rng, regex, i)
  27. boost::adaptors::tokenize(rng, regex, rndRng)
  28. boost::adaptors::tokenize(rng, regex, i, flags)
  29. boost::adaptors::tokenize(rng, regex, rndRng, flags)
  30. ``
  31. ]
  32. ]
  33. ]
  34. * [*Precondition:]
  35. * Let `T` denote `typename range_value<decltype(rng)>::type`, then `regex` has the type `basic_regex<T>` or is implicitly convertible to one of these types.
  36. * `i` has the type `int`.
  37. * the `value_type` of `rndRng` is `int`.
  38. * `flags` has the type `regex_constants::syntax_option_type`.
  39. * [*Returns:] A range whose iterators behave as if they were the original iterators wrapped in `regex_token_iterator`. The first iterator in the range would be constructed by forwarding all the arguments of `tokenized()` to the `regex_token_iterator` constructor.
  40. * [*Throws:] Whatever constructing and copying equivalent `regex_token_iterator`s might throw.
  41. * [*Range Category:] __random_access_range__
  42. * [*Range Return Type:] `boost::tokenized_range<decltype(rng)>`
  43. * [*Returned Range Category:] __random_access_range__
  44. [section:tokenized_example tokenized_example]
  45. [import ../../../test/adaptor_test/tokenized_example.cpp]
  46. [tokenized_example]
  47. [endsect]
  48. This would produce the output:
  49. ``
  50. a
  51. b
  52. c
  53. d
  54. e
  55. f
  56. g
  57. hijklmnopqrstuvwxyz
  58. ``
  59. [endsect]