]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/csg.cpp
Support lambda callbacks
[xonotic/netradiant.git] / radiant / csg.cpp
index 5676401eb982d0ce37bbdbde391c8ab67c71f551..2538359fc96a8ac5d8e9b7285c22058368d940db 100644 (file)
@@ -166,11 +166,9 @@ class Dereference
 {
 const Functor& functor;
 public:
-typedef typename RemoveReference<typename Functor::first_argument_type>::type* first_argument_type;
-typedef typename Functor::result_type result_type;
 Dereference( const Functor& functor ) : functor( functor ){
 }
-result_type operator()( first_argument_type firstArgument ) const {
+get_result_type<Functor> operator()( typename RemoveReference<get_argument<Functor, 0>>::type *firstArgument ) const {
        return functor( *firstArgument );
 }
 };
@@ -192,15 +190,13 @@ Face* Brush_findIf( const Brush& brush, const Predicate& predicate ){
 template<typename Caller>
 class BindArguments1
 {
-typedef typename Caller::second_argument_type FirstBound;
+typedef get_argument<Caller, 1> FirstBound;
 FirstBound firstBound;
 public:
-typedef typename Caller::result_type result_type;
-typedef typename Caller::first_argument_type first_argument_type;
 BindArguments1( FirstBound firstBound )
        : firstBound( firstBound ){
 }
-result_type operator()( first_argument_type firstArgument ) const {
+get_result_type<Caller> operator()( get_argument<Caller, 0> firstArgument ) const {
        return Caller::call( firstArgument, firstBound );
 }
 };
@@ -208,17 +204,15 @@ result_type operator()( first_argument_type firstArgument ) const {
 template<typename Caller>
 class BindArguments2
 {
-typedef typename Caller::second_argument_type FirstBound;
-typedef typename Caller::third_argument_type SecondBound;
+typedef get_argument<Caller, 1> FirstBound;
+typedef get_argument<Caller, 2> SecondBound;
 FirstBound firstBound;
 SecondBound secondBound;
 public:
-typedef typename Caller::result_type result_type;
-typedef typename Caller::first_argument_type first_argument_type;
 BindArguments2( FirstBound firstBound, SecondBound secondBound )
        : firstBound( firstBound ), secondBound( secondBound ){
 }
-result_type operator()( first_argument_type firstArgument ) const {
+get_result_type<Caller> operator()( get_argument<Caller, 0> firstArgument ) const {
        return Caller::call( firstArgument, firstBound, secondBound );
 }
 };