All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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

using SpanDocumentation1TestClass::Data_t = std::vector<int>

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()
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
Simple class with a begin and an end.
Definition: span.h:125
int sum(util::span< Data_t::iterator > r)
Definition: span_test.cc:217
BEGIN_PROLOG could also be cout
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
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60

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