|
@@ -63,8 +63,10 @@ struct {obj_name} {{
|
|
|
for field in obj_attrs['fields']:
|
|
|
name = field['name']
|
|
|
type_ = field['type']
|
|
|
+ # Because vector<bool> is packed, a temporary object is created so we can't return a reference.
|
|
|
+ ret_type = f'{type_}&' if type_ != 'bool' else type_
|
|
|
src.append(f'''\
|
|
|
- const {type_}& {name}() const {{
|
|
|
+ const {ret_type} {name}() const {{
|
|
|
if (!collection->{name}_loaded) {{
|
|
|
collection->val_{name} = collection->tds->track_branch_obj<vector<{type_}>>("{prefix}_{name}");
|
|
|
collection->{name}_loaded = true;
|