fork download
  1. #include <iostream>
  2.  
  3. template<int n>
  4. struct mosiv{int data[n];};
  5.  
  6. template<int n>
  7. using mosiv_ptr = mosiv<n> *;
  8.  
  9.  
  10. int main() {
  11. int petuhi[] = {1, 2, 3, 4, 5};
  12. int krestuhi[5];
  13. *(mosiv_ptr<5>)&krestuhi = *(mosiv_ptr<5>)&petuhi;
  14.  
  15. for(int i = 0; i < 5; ++i) {
  16. std::cout << krestuhi[i] << ", ";
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4368KB
stdin
Standard input is empty
stdout
1, 2, 3, 4, 5,