mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-11 15:49:38 +00:00
Attempt to move towards at-launch field declaration.
This avoids any need for overt thread safety in mutations.
This commit is contained in:
parent
d7206096ea
commit
fd1bd3032f
@ -27,6 +27,12 @@ namespace Reflection {
|
||||
|
||||
#define DeclareField(Name) declare(&Name, #Name)
|
||||
|
||||
#define BeginDeclarations () void declare_fields() {
|
||||
#define EndDeclarations () } \
|
||||
struct Declarer { Declarer() { Target t; t.declare_fields(); } }; \
|
||||
static Declarer declarer;
|
||||
|
||||
|
||||
struct Struct {
|
||||
virtual std::vector<std::string> all_keys() const = 0;
|
||||
virtual const std::type_info *type_of(const std::string &name) const = 0;
|
||||
@ -300,7 +306,7 @@ protected:
|
||||
/*!
|
||||
@returns @c true if this subclass of @c Struct has not yet declared any fields.
|
||||
*/
|
||||
bool needs_declare() {
|
||||
bool needs_declare() const {
|
||||
return contents_.empty();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user