Public Types | Public Member Functions | List of all members
SpanDocumentation1TestClass Struct Reference

Public Types

using Data_t = std::vector< int >
 

Public Member Functions

int sum (util::span< Data_t::iterator > r)
 
void analyse ()
 

Detailed Description

Definition at line 214 of file span_test.cc.

Member Typedef Documentation

Definition at line 215 of file span_test.cc.

Member Function Documentation

void SpanDocumentation1TestClass::analyse ( )
inline

Definition at line 223 of file span_test.cc.

223  {
224 
225  Data_t v(10U);
226  std::iota(v.begin(), v.end(), 1); // { 1, 2, 3, 4 ,5 ,6, 7, 8, 9, 10 }
227 
228  auto span5 = util::span(v.begin(), v.begin() + 5);
229  std::cout << "Sum of 5 numbers: " << sum(span5) << std::endl;
230 
231  auto span8 = util::span(v.begin(), v.begin() + 8);
232  std::cout << "Sum of 8 numbers: " << sum(span8) << std::endl;
233 
234  auto full_span = util::make_span(v);
235  std::cout << "Sum of all numbers: " << sum(full_span) << std::endl;
236 
237  } // analyse()
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
std::vector< int > Data_t
Definition: span_test.cc:215
auto make_span(BIter begin, EIter end)
Creates a span from specified iterators (can use constructor instead).
Definition: span.h:197
int sum(util::span< Data_t::iterator > r)
Definition: span_test.cc:217
QTextStream & endl(QTextStream &s)
int SpanDocumentation1TestClass::sum ( util::span< Data_t::iterator r)
inline

Definition at line 217 of file span_test.cc.

217  {
218  decltype(r)::value_type s = 0;
219  for (auto v: r) s += v;
220  return s;
221  } // sum
static QCString * s
Definition: config.cpp:1042

The documentation for this struct was generated from the following file: