Added Arity to projection functor classes.

This commit is contained in:
Michael Hoffmann 2003-08-25 14:37:41 +00:00
parent 26a5782a4f
commit d3b39eafad
2 changed files with 29 additions and 0 deletions

View File

@ -2,6 +2,11 @@
// Revision History for package STL_Extension
//=====================================================================
//---------------------------------------------------------------------
// revision 292
//---------------------------------------------------------------------
- Added Arity to projection functor classes.
//---------------------------------------------------------------------
// revision 291
//---------------------------------------------------------------------

View File

@ -29,6 +29,8 @@
#ifndef CGAL_FUNCTION_OBJECTS_H
#define CGAL_FUNCTION_OBJECTS_H 1
#include <CGAL/functional_base.h>
#include <functional>
CGAL_BEGIN_NAMESPACE
@ -37,6 +39,7 @@ template < class Value>
struct Identity {
typedef Value argument_type;
typedef Value result_type;
typedef Arity_tag<1> Arity;
Value& operator()( Value& x) const { return x; }
const Value& operator()( const Value& x) const { return x; }
};
@ -45,6 +48,7 @@ template < class Value>
struct Dereference {
typedef Value* argument_type;
typedef Value result_type;
typedef Arity_tag<1> Arity;
Value& operator()( Value* x) const { return *x;}
const Value& operator()( const Value* x) const { return *x;}
};
@ -53,6 +57,7 @@ template < class Value>
struct Get_address {
typedef Value argument_type;
typedef Value* result_type;
typedef Arity_tag<1> Arity;
Value* operator()( Value& x) const { return &x;}
const Value* operator()( const Value& x) const { return &x;}
};
@ -61,6 +66,7 @@ template < class Arg, class Result>
struct Cast_function_object {
typedef Arg argument_type;
typedef Result result_type;
typedef Arity_tag<1> Arity;
Result& operator()( Arg& x) const { return (Result&)(x); }
const Result& operator()( const Arg& x) const {
return (const Result&)(x);
@ -72,6 +78,7 @@ struct Project_vertex {
typedef Node argument_type;
typedef typename Node::Vertex Vertex;
typedef Vertex result_type;
typedef Arity_tag<1> Arity;
Vertex& operator()( Node& x) const { return x.vertex(); }
const Vertex& operator()( const Node& x) const { return x.vertex(); }
};
@ -81,6 +88,7 @@ struct Project_facet {
typedef Node argument_type;
typedef typename Node::Facet Facet;
typedef Facet result_type;
typedef Arity_tag<1> Arity;
Facet& operator()( Node& x) const { return x.facet(); }
const Facet& operator()( const Node& x) const { return x.facet(); }
};
@ -90,6 +98,7 @@ struct Project_point {
typedef Node argument_type;
typedef typename Node::Point Point;
typedef Point result_type;
typedef Arity_tag<1> Arity;
Point& operator()( Node& x) const { return x.point(); }
const Point& operator()( const Node& x) const { return x.point(); }
};
@ -99,6 +108,7 @@ struct Project_normal {
typedef Node argument_type;
typedef typename Node::Normal Normal;
typedef Normal result_type;
typedef Arity_tag<1> Arity;
Normal& operator()( Node& x) const { return x.normal(); }
const Normal& operator()( const Node& x) const { return x.normal(); }
};
@ -108,6 +118,7 @@ struct Project_plane {
typedef Node argument_type;
typedef typename Node::Plane Plane;
typedef Plane result_type;
typedef Arity_tag<1> Arity;
Plane& operator()( Node& x) const { return x.plane(); }
const Plane& operator()( const Node& x) const { return x.plane(); }
};
@ -118,6 +129,7 @@ template < class Node>
struct Project_next {
typedef Node* argument_type;
typedef Node* result_type;
typedef Arity_tag<1> Arity;
Node* operator()( Node* x) const { return x->next(); }
const Node* operator()( const Node* x) const { return x->next(); }
};
@ -126,6 +138,7 @@ template < class Node>
struct Project_prev {
typedef Node* argument_type;
typedef Node* result_type;
typedef Arity_tag<1> Arity;
Node* operator()( Node* x) const { return x->prev(); }
const Node* operator()( const Node* x) const { return x->prev(); }
};
@ -134,6 +147,7 @@ template < class Node>
struct Project_next_opposite {
typedef Node* argument_type;
typedef Node* result_type;
typedef Arity_tag<1> Arity;
Node* operator()( Node* x) const {
return x->next()->opposite();
}
@ -146,6 +160,7 @@ template < class Node>
struct Project_opposite_prev {
typedef Node* argument_type;
typedef Node* result_type;
typedef Arity_tag<1> Arity;
Node* operator()( Node* x) const {
return x->opposite()->prev();
}
@ -159,6 +174,7 @@ public:
typedef Arg argument_type;
typedef Arg argument1_type;
typedef Result result_type;
typedef Arity_tag<1> Arity;
Result operator()(Arg a) const { return Result(a);}
};
@ -168,6 +184,7 @@ public:
typedef Arg1 argument1_type;
typedef Arg2 argument2_type;
typedef Result result_type;
typedef Arity_tag<2> Arity;
Result operator()(Arg1 a1, Arg2 a2) const { return Result(a1,a2);}
};
@ -178,6 +195,7 @@ public:
typedef Arg2 argument2_type;
typedef Arg3 argument3_type;
typedef Result result_type;
typedef Arity_tag<3> Arity;
Result operator()(Arg1 a1, Arg2 a2, Arg3 a3) const {
return Result(a1,a2,a3);
}
@ -191,6 +209,7 @@ public:
typedef Arg3 argument3_type;
typedef Arg4 argument4_type;
typedef Result result_type;
typedef Arity_tag<4> Arity;
Result operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4) const {
return Result(a1,a2,a3,a4);
}
@ -206,6 +225,7 @@ public:
typedef Arg4 argument4_type;
typedef Arg5 argument5_type;
typedef Result result_type;
typedef Arity_tag<5> Arity;
Result operator()(Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5) const {
return Result(a1,a2,a3,a4,a5);
}
@ -218,6 +238,7 @@ public:
typedef Arg argument1_type;
typedef Arg argument2_type;
typedef Result result_type;
typedef Arity_tag<2> Arity;
Result operator()(Arg a1, Arg a2) const { return Result(a1,a2);}
};
@ -229,6 +250,7 @@ public:
typedef Arg argument2_type;
typedef Arg argument3_type;
typedef Result result_type;
typedef Arity_tag<3> Arity;
Result operator()(Arg a1, Arg a2, Arg a3) const {
return Result(a1,a2,a3);
}
@ -243,6 +265,7 @@ public:
typedef Arg argument3_type;
typedef Arg argument4_type;
typedef Result result_type;
typedef Arity_tag<4> Arity;
Result operator()(Arg a1, Arg a2, Arg a3, Arg a4) const {
return Result(a1,a2,a3,a4);
}
@ -258,6 +281,7 @@ public:
typedef Arg argument4_type;
typedef Arg argument5_type;
typedef Result result_type;
typedef Arity_tag<5> Arity;
Result operator()(Arg a1, Arg a2, Arg a3, Arg a4, Arg a5) const {
return Result(a1,a2,a3,a4,a5);
}