JavaScript ES6 には、 destructuringと呼ばれる言語機能があります。他の多くの言語にも存在します。
JavaScript ES6 では、次のようになります。
var animal = {
species: 'dog',
weight: 23,
sound: 'woof'
}
//Destructuring
var {species, sound} = animal
//The dog says woof!
console.log('The ' + species + ' says ' + sound + '!')
同様の構文を取得し、この種の機能をエミュレートするには、C++ で何ができますか?