From 62ed0e4728ab0238c47f03dea38782a599bff3fb Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 26 Mar 2015 17:40:31 -0700 Subject: 978 --- cpp/018record | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cpp/018record') diff --git a/cpp/018record b/cpp/018record index 91e142a3..5c1715a4 100644 --- a/cpp/018record +++ b/cpp/018record @@ -144,3 +144,23 @@ recipe main [ +run: ingredient 1 is 1 +run: address to copy is 13 +mem: storing 13 in location 15 + +:(scenario "copy_handles_nested_record_elements") +recipe main [ + 12:integer <- copy 34:literal + 13:integer <- copy 35:literal + 14:integer <- copy 36:literal + 15:point-integer <- copy 12:point-integer +] ++mem: storing 36 in location 17 + +:(before "End size_of Cases") +if (t.is_record) { + size_t result = 0; + for (size_t i = 0; i < t.elements.size(); ++i) { + reagent x; + x.types.push_back(t.elements[i][0]); + result += size_of(x); + } + return result; +} -- cgit 1.4.1-2-gfad0