Skip to content

Commit 21ae066

Browse files
authored
Fixed Ambiguous Function Calls with Enum Functions
1 parent c79a34c commit 21ae066

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/flecs/addons/cpp/mixins/entity/builder.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct entity_builder : entity_view {
8686
* @tparam First The first element of the pair
8787
* @param second The second element of the pair.
8888
*/
89-
template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
89+
template<typename First, typename Second, if_not_t< is_enum<Second>::value && std::is_same<First, Second>::value > = 0>
9090
const Self& add(Second second) const {
9191
flecs_static_assert(is_flecs_constructible<First>::value,
9292
"cannot default construct type: add T::T() or use emplace<T>()");
@@ -100,7 +100,7 @@ struct entity_builder : entity_view {
100100
* @tparam First The first element of the pair
101101
* @param constant the enum constant.
102102
*/
103-
template<typename First, typename Second, if_t< is_enum<Second>::value > = 0>
103+
template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
104104
const Self& add(Second constant) const {
105105
flecs_static_assert(is_flecs_constructible<First>::value,
106106
"cannot default construct type: add T::T() or use emplace<T>()");
@@ -375,7 +375,7 @@ struct entity_builder : entity_view {
375375
* @tparam First The first element of the pair
376376
* @param constant the enum constant.
377377
*/
378-
template<typename First, typename Second, if_t< is_enum<Second>::value > = 0>
378+
template<typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
379379
const Self& remove(Second constant) const {
380380
const auto& et = enum_type<Second>(this->world_);
381381
flecs::entity_t second = et.entity(constant);
@@ -790,7 +790,7 @@ struct entity_builder : entity_view {
790790
* @param constant The enum constant.
791791
* @param value The value to set.
792792
*/
793-
template <typename First, typename Second, if_t< is_enum<Second>::value > = 0>
793+
template <typename First, typename Second, if_t< is_enum<Second>::value && !std::is_same<First, Second>::value > = 0>
794794
const Self& set(Second constant, const First& value) const {
795795
const auto& et = enum_type<Second>(this->world_);
796796
flecs::entity_t second = et.entity(constant);

0 commit comments

Comments
 (0)