Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No member named 'size' in namespace 'std'

Tags:

c++

c++17

I'm trying to port some C++ code from Windows to OS X (using Xcode).

The following code:

writePosition %= std::size(bufferL);

is generating an error:

No member named 'size' in namespace 'std'

How do I fix this?

like image 338
Chris Share Avatar asked Dec 03 '22 19:12

Chris Share


1 Answers

std::size() is available starting from C++17. Try enabling -std=c++17 for your compiler.

Also, double check that the source files contain #include <iterator>, either directly, or indirectly by #include'ing any of the following headers:

  • <array>
  • <deque>
  • <forward_list>
  • <list>
  • <map>
  • <regex>
  • <set>
  • <string>
  • <string_view>
  • <unordered_map>
  • <unordered_set>
  • <vector>
like image 138
Dev Null Avatar answered Dec 24 '22 03:12

Dev Null