fork(3) download
  1. #include <iostream>
  2. #include <string>
  3. #include <chrono>
  4. #include <boost/shared_ptr.hpp>
  5. #include <map>
  6. #include <list>
  7. #include <boost/locale.hpp>
  8.  
  9. typedef std::u32string string_type;
  10. typedef std::pair<unsigned long, unsigned long> range_type;
  11. typedef std::map<std::string, std::list<range_type>> wordref_type;
  12.  
  13. struct parser{
  14. /**
  15.   * returns a map of "words" with its positions list
  16.   */
  17. static wordref_type parse(string_type::const_iterator b, string_type::const_iterator e){
  18. wordref_type wordrefs;
  19. range_type sentence;
  20.  
  21. boost::locale::boundary::segment_index<string_type::const_iterator> index(boost::locale::boundary::word, b, e);
  22.  
  23. return wordrefs;
  24. }
  25. };
  26.  
  27. int main(int argc, char** argv){
  28. std::string input_str = "Some UTF-8 texts";
  29. string_type buffer = boost::locale::conv::utf_to_utf<string_type::value_type>(input_str); // convert utf-8 to utf-32
  30. wordref_type wordrefs = parser::parse(buffer.cbegin(), buffer.cend());
  31. return 0;
  32. }
  33.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/boost/locale/boundary.hpp:15:0,
                 from /usr/include/boost/locale.hpp:11,
                 from prog.cpp:7:
/usr/include/boost/locale/boundary/index.hpp: In instantiation of ‘static boost::locale::boundary::index_type boost::locale::boundary::details::mapping_traits<IteratorType, std::random_access_iterator_tag>::map(boost::locale::boundary::boundary_type, IteratorType, IteratorType, const std::locale&) [with IteratorType = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::index_type = std::vector<boost::locale::boundary::break_info>]’:
/usr/include/boost/locale/boundary/index.hpp:126:83:   required from ‘boost::locale::boundary::details::mapping<BaseIterator>::mapping(boost::locale::boundary::boundary_type, boost::locale::boundary::details::mapping<BaseIterator>::base_iterator, boost::locale::boundary::details::mapping<BaseIterator>::base_iterator, const std::locale&) [with BaseIterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::details::mapping<BaseIterator>::base_iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >]’
/usr/include/boost/locale/boundary/index.hpp:631:43:   required from ‘boost::locale::boundary::segment_index<BaseIterator>::segment_index(boost::locale::boundary::boundary_type, boost::locale::boundary::segment_index<BaseIterator>::base_iterator, boost::locale::boundary::segment_index<BaseIterator>::base_iterator, const std::locale&) [with BaseIterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::segment_index<BaseIterator>::base_iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >]’
prog.cpp:21:118:   required from here
/usr/include/boost/locale/boundary/index.hpp:98:93: error: invalid use of incomplete type ‘const class boost::locale::boundary::boundary_indexing<char32_t>’
                             index_type tmp=std::use_facet<boundary_indexing<char_type> >(l).map(t,begin,end);
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/boost/locale/boundary.hpp:12:0,
                 from /usr/include/boost/locale.hpp:11,
                 from prog.cpp:7:
/usr/include/boost/locale/boundary/facets.hpp:90:19: note: declaration of ‘class boost::locale::boundary::boundary_indexing<char32_t>’
             class boundary_indexing;
                   ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/locale/boundary.hpp:15:0,
                 from /usr/include/boost/locale.hpp:11,
                 from prog.cpp:7:
/usr/include/boost/locale/boundary/index.hpp:103:95: error: invalid use of incomplete type ‘const class boost::locale::boundary::boundary_indexing<char32_t>’
                             index_type tmp = std::use_facet<boundary_indexing<char_type> >(l).map(t,str.c_str(),str.c_str()+str.size());
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/boost/locale/boundary.hpp:12:0,
                 from /usr/include/boost/locale.hpp:11,
                 from prog.cpp:7:
/usr/include/boost/locale/boundary/facets.hpp:90:19: note: declaration of ‘class boost::locale::boundary::boundary_indexing<char32_t>’
             class boundary_indexing;
                   ^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/bits/locale_classes.h:850:0,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/locale_classes.tcc: In instantiation of ‘const _Facet& std::use_facet(const std::locale&) [with _Facet = boost::locale::boundary::boundary_indexing<char32_t>]’:
/usr/include/boost/locale/boundary/index.hpp:98:89:   required from ‘static boost::locale::boundary::index_type boost::locale::boundary::details::mapping_traits<IteratorType, std::random_access_iterator_tag>::map(boost::locale::boundary::boundary_type, IteratorType, IteratorType, const std::locale&) [with IteratorType = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::index_type = std::vector<boost::locale::boundary::break_info>]’
/usr/include/boost/locale/boundary/index.hpp:126:83:   required from ‘boost::locale::boundary::details::mapping<BaseIterator>::mapping(boost::locale::boundary::boundary_type, boost::locale::boundary::details::mapping<BaseIterator>::base_iterator, boost::locale::boundary::details::mapping<BaseIterator>::base_iterator, const std::locale&) [with BaseIterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::details::mapping<BaseIterator>::base_iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >]’
/usr/include/boost/locale/boundary/index.hpp:631:43:   required from ‘boost::locale::boundary::segment_index<BaseIterator>::segment_index(boost::locale::boundary::boundary_type, boost::locale::boundary::segment_index<BaseIterator>::base_iterator, boost::locale::boundary::segment_index<BaseIterator>::base_iterator, const std::locale&) [with BaseIterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >; boost::locale::boundary::segment_index<BaseIterator>::base_iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::__cxx11::basic_string<char32_t> >]’
prog.cpp:21:118:   required from here
/usr/include/c++/6/bits/locale_classes.tcc:134:37: error: incomplete type ‘boost::locale::boundary::boundary_indexing<char32_t>’ used in nested name specifier
       const size_t __i = _Facet::id._M_id();
                          ~~~~~~~~~~~^~~~~
stdout
Standard output is empty