Кресты / Говнокод #25445 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
#include <type_traits>

struct Foo {
  void bar(int) const & {}
};

int main() {    
  using MethodPtr = decltype(&Foo::bar);
  const MethodPtr arr[] = { &Foo::bar };
  auto *ptr = &arr;
  auto &ref = ptr;

  static_assert(std::is_same_v<decltype(ref), void (Foo::* const (*&)[1])(int) const &>);
}

Магия указателей возведенная в степень магии массивов в степени магии ссылок.

https://wandbox.org/permlink/8DygQ6oocrEY1K1M

Запостил: Elvenfighter Elvenfighter, (Updated )

Комментарии (23) RSS

Добавить комментарий

Помни, guest, за тобой могут следить!

    А не использовать ли нам bbcode?


    8