fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. // Based on Richard Smith trick for constexpr lambda
  4. // via Paul Fultz II (http://p...content-available-to-author-only...2.com/blog/2014/09/02/static-lambda/)
  5. template<typename T>
  6. auto addr(T &&t)
  7. {
  8. return &t;
  9. }
  10.  
  11.  
  12. static const constexpr auto odr_helper = true ? nullptr : addr([](){});
  13.  
  14. template <class T = decltype(odr_helper)>
  15. inline void g() {
  16. int arr[2] = {};
  17. std::for_each(arr, arr+2, [] (int i) {std::cout << i << ' ';});
  18. }
  19.  
  20. int main()
  21. {
  22.  
  23. g();
  24. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
0 0