fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A
  5. {
  6. static std::initializer_list<int> a()
  7. {
  8. return { 1, 2, 3 };
  9. }
  10. };
  11.  
  12. struct B
  13. {
  14. B( std::initializer_list<int> b )
  15. {
  16. for( auto&& x : b ) cout << x << "\n";
  17. }
  18. };
  19.  
  20. int main() {
  21.  
  22. auto sth = A::a();
  23. B b{ sth };
  24. B c{ 4, 5, 6};
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6