Skip to content

Commit

Permalink
Changed the "ref" macro to "eref" otherwise it conflicts with somethi…
Browse files Browse the repository at this point in the history
…ng inside the STL.
  • Loading branch information
parnham committed Aug 2, 2013
1 parent 09dc3c2 commit da48663
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct Simple : entity

mapping map()
{
return mapping() << ref(name) << ref(flag) << ref("int", integer);
return mapping() << eref(name) << eref(flag) << eref("int", integer);
}
};

Expand Down Expand Up @@ -114,7 +114,7 @@ Any class or struct that descends from
must implement the
[map](https://github.com/emergent-design/libentity/wiki/Entity#map)
function which allows the library to do its magic without the need for a
pre-compilation step. The macro ```ref``` simply expands to a
pre-compilation step. The macro ```eref``` simply expands to a
```mapping::reference``` instance and if no name is provided it will
automagically use the parameter name (so avoid using ```this->```).
By allowing the name to be specified, as in the "int" example above, it can map a
Expand Down
6 changes: 3 additions & 3 deletions include/entity/mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace ent
// If two arguments are passed then the supplied name is used as the mapping key
#ifndef ent_ref
#define ent_get_ref(_1, _2, name, ...) name
#define ent_auto_ref(item) mapping::reference(#item, item)
#define ent_man_ref(name, item) mapping::reference(name, item)
#define ent_auto_ref(item) ent::mapping::reference(#item, item)
#define ent_man_ref(name, item) ent::mapping::reference(name, item)
#define ent_ref(...) ent_get_ref(__VA_ARGS__, ent_man_ref, ent_auto_ref)(__VA_ARGS__)

// Concise call to ent_ref, disable if it conflicts and use ent_ref instead
#define ref ent_ref
#define eref ent_ref
#endif


Expand Down
6 changes: 3 additions & 3 deletions src/test/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct SimpleEntity : entity

mapping map()
{
return mapping() << ref(name) << ref(flag) << ref(integer);
return mapping() << eref(name) << eref(flag) << eref(integer);
}
};

Expand All @@ -29,7 +29,7 @@ struct CollectionEntity : entity

mapping map()
{
return mapping() << ref(strings) << ref(doubles) << ref(binary) << ref(dictionary);
return mapping() << eref(strings) << eref(doubles) << eref(binary) << eref(dictionary);
}
};

Expand All @@ -43,7 +43,7 @@ struct ComplexEntity : entity

mapping map()
{
return mapping() << ref(name) << ref(entities) << ref(collection) << ref(simple);
return mapping() << eref(name) << eref(entities) << eref(collection) << eref(simple);
}
};

Expand Down

0 comments on commit da48663

Please sign in to comment.