Skip to content

Commit 7a08b4e

Browse files
committed
make getchildrenext have a changable type param
1 parent cf9e899 commit 7a08b4e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

loader/include/Geode/cocos/base_nodes/CCNode.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace geode {
4545
class LayoutOptions;
4646
enum class Anchor;
4747

48-
template <typename T>
48+
template <typename T, typename>
4949
struct CCArrayExtCheck {
5050
using type = void;
5151
};
@@ -644,12 +644,12 @@ class CC_DLL CCNode : public CCObject
644644
* Like `getChildren()`, but returns a `CCArrayExt<CCNode>` instead.
645645
* You must include `<Geode/utils/cocos.hpp>` to use this, otherwise it won't compile
646646
*/
647-
template <typename PleaseDontChangeMe = CCNode>
647+
template <typename T = CCNode, typename PleaseDontChangeMe = void>
648648
inline auto getChildrenExt() {
649649
// CCArrayExt is defined in geode/utils/cocos.hpp, which we cannot include due to circular includes.
650650
// This is an incredibly hacky way to still be able to use the type
651651

652-
using CCArrayExt = geode::CCArrayExtCheck<PleaseDontChangeMe>::type;
652+
using CCArrayExt = geode::CCArrayExtCheck<T, PleaseDontChangeMe>::type;
653653
static_assert(!std::is_void_v<CCArrayExt>, "Please include <Geode/utils/cocos.hpp> to use getChildrenExt()");
654654

655655
return CCArrayExt(getChildren());

loader/include/Geode/utils/cocos.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ namespace geode::cocos {
16431643
void GEODE_DLL handleTouchPriority(cocos2d::CCNode* node, bool force = false);
16441644
}
16451645

1646-
template <>
1647-
struct ::geode::CCArrayExtCheck<cocos2d::CCNode> {
1648-
using type = cocos::CCArrayExt<cocos2d::CCNode>;
1646+
template <typename T>
1647+
struct ::geode::CCArrayExtCheck<T, void> {
1648+
using type = cocos::CCArrayExt<T>;
16491649
};

0 commit comments

Comments
 (0)