ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
WordBreak.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File WordBreak.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
26/*--------------------------------------------------------------------------*/
27/*----------------------------- DEFINITIONS --------------------------------*/
28/*--------------------------------------------------------------------------*/
29
30#ifndef __ADS_WordBreak
31 #define __ADS_WordBreak
32/* self-identification: #endif constant */
33
34/*--------------------------------------------------------------------------*/
35/*------------------------------ INCLUDES ----------------------------------*/
36/*--------------------------------------------------------------------------*/
37
38#include <cstddef>
39#include "ADS/Contract.h"
40
41#include <numeric>
42#include <optional>
43#include <string>
44#include <vector>
45
46/*--------------------------------------------------------------------------*/
47/*--------------------------- NAMESPACE ------------------------------------*/
48/*--------------------------------------------------------------------------*/
49
50namespace ADS
51{
52
77template< class F >
78std::optional< std::vector< std::string > >
79wordBreak( const std::string & s , F && lookup ,
80 std::size_t longest = std::string::npos ,
81 long * lookups = nullptr );
82
83/*--------------------------------------------------------------------------*/
84
85} // end( namespace ADS )
86
87/*--------------------------------------------------------------------------*/
88/*-------------------------- IMPLEMENTATION --------------------------------*/
89/*--------------------------------------------------------------------------*/
90
91#include "ADS/string/impl/WordBreak.tpp"
92
93/*--------------------------------------------------------------------------*/
94
95#endif /* WordBreak.h included */
96
97/*--------------------------------------------------------------------------*/
98/*-------------------------- End File WordBreak.h --------------------------*/
99/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::optional< std::vector< std::string > > wordBreak(const std::string &s, F &&lookup, std::size_t longest=std::string::npos, long *lookups=nullptr)
the words of , if it is a sequence of words, by the lookup( word ) of a dictionary; the lookups made ...
Definition ADT.h:96