fork download
  1. import std.stdio;
  2. import std.algorithm.iteration : joiner, map;
  3. import std.array : array;
  4.  
  5. struct order{
  6. string[] products;
  7.  
  8. this(typeof(this.products) products) { this.products = products; }
  9. }
  10.  
  11. void main()
  12. {
  13. auto orders = [
  14. order(["Молоко", "Шоколад"])
  15. , order(["Конфеты"])
  16. , order(["Печенье", "Чай"])
  17. ];
  18.  
  19. auto p = orders
  20. .map!(a => a.products)
  21. .joiner
  22. .array;
  23. writeln(p);
  24. }
  25.  
Success #stdin #stdout 0s 2748KB
stdin
Standard input is empty
stdout
["Молоко", "Шоколад", "Конфеты", "Печенье", "Чай"]