diff --git a/ctle_code_gen/property_generator.py b/ctle_code_gen/property_generator.py index d5d36da..dc721c7 100644 --- a/ctle_code_gen/property_generator.py +++ b/ctle_code_gen/property_generator.py @@ -164,14 +164,15 @@ def generate_property( path:str ): out.ln('#pragma once') out.ln() out.ln('#include ') + out.ln('#include ') out.ln('#include "status.h"') out.ln() out.ln('namespace ctle') with out.blk(): out.comment_ln('trivially_default_constructible_identity_assign is a conditional template function which initializes trivially constructable values using the = {} assignment. For all other types, the template is a noop and does nothing.') - out.ln('template{},bool> = true> void trivially_default_constructible_identity_assign( _Ty &val ) { val = {}; }') - out.ln('template{},bool> = true> void trivially_default_constructible_identity_assign( _Ty & ) { /*noop*/ }') + out.ln('template{},bool>::type = true> void trivially_default_constructible_identity_assign( _Ty &val ) { val = {}; }') + out.ln('template{},bool>::type = true> void trivially_default_constructible_identity_assign( _Ty & ) { /*noop*/ }') out.ln() out.comment_ln('The property_[...] template classes are a convenient way to implement properties in classes, where each property can be accessed as a normal variable, but can also be made read-only, write-only, read/write, and let the owner class override if a value is returned from a variable, or evaluated on-the-fly, etc.') diff --git a/unit_tests/test_property.cpp b/unit_tests/test_property.cpp index f939bdf..60cb800 100644 --- a/unit_tests/test_property.cpp +++ b/unit_tests/test_property.cpp @@ -104,7 +104,7 @@ class folks persons.v.resize(nums); for (size_t i = 0; i < (size_t)nums; ++i) { - persons.v[i] = std::make_unique(); + persons.v[i] = std::unique_ptr( new person() ); } simple_int.v = nums; } @@ -112,7 +112,7 @@ class folks }; folks::folks() - : persons( [this]( const auto *prop, status &result ) -> const auto & + : persons( [this]( const property_getcref_value>, folks> *prop, status &result ) -> const std::vector> & { if( prop->v.size() < 30 ) { @@ -123,7 +123,7 @@ folks::folks() return prop->v; } ) - , simple_int( 23 , [this]( const auto *prop, status & ) -> const auto & { return prop->v; } ) + , simple_int( 23 , [this]( const property_getcref_value *prop, status & ) -> const int & { return prop->v; } ) { }