Wouldn't this break generic stuff with collections that expect non-member functions?

On Fri, Jun 12, 2020 at 18:56 Filippo Casarin via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
With the current c++20 standard the following code

#include <array>
struct S {
    std::array<int, 4> arr;

    void foo() {
        static_assert(arr.size());
    }
};

generate this error

main.cpp: In member function ‘void S::foo()’:
main.cpp:7:31: error: non-constant condition for static assertion
    7 |         static_assert(arr.size());
      |                       ~~~~~~~~^~
main.cpp:7:31: error: use of ‘this’ in a constant expression

This would work if std::array::size would be static, also I don't think any old code would break for this change.

std::array::max_size and std::array::empty are similar and I think should be static.

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals