*** empty log message ***

This commit is contained in:
Michael Hoffmann 1999-09-01 19:32:32 +00:00
parent 235c358f19
commit eb416d9049
10 changed files with 329 additions and 25 deletions

View File

@ -0,0 +1,28 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
#include <functional>
using std::vector;
using std::cout;
using std::endl;
using std::modulus;
using std::greater;
using std::compose1;
using std::bind2nd;
using CGAL::min_element_if;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(5);
v.push_back(2);
cout << "min_odd = "
<< *min_element_if(v.begin(),
v.end(),
compose1(bind2nd(greater< int >(), 0),
bind2nd(modulus< int >(), 2)))
<< endl;
return 0;
}

View File

@ -0,0 +1,21 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
using std::vector;
using std::pair;
using std::cout;
using std::endl;
using CGAL::min_max_element;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(6);
v.push_back(5);
typedef std::vector< int >::iterator iterator;
pair< iterator, iterator > p = min_max_element(v.begin(), v.end());
cout << "min = " << *p.first << ", max = " << *p.second << endl;
return 0;
}

View File

@ -0,0 +1,28 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
#include <functional>
using std::vector;
using std::cout;
using std::endl;
using std::modulus;
using std::greater;
using std::compose1;
using std::bind2nd;
using CGAL::min_element_if;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(5);
v.push_back(2);
cout << "min_odd = "
<< *min_element_if(v.begin(),
v.end(),
compose1(bind2nd(greater< int >(), 0),
bind2nd(modulus< int >(), 2)))
<< endl;
return 0;
}

View File

@ -0,0 +1,21 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
using std::vector;
using std::pair;
using std::cout;
using std::endl;
using CGAL::min_max_element;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(6);
v.push_back(5);
typedef std::vector< int >::iterator iterator;
pair< iterator, iterator > p = min_max_element(v.begin(), v.end());
cout << "min = " << *p.first << ", max = " << *p.second << endl;
return 0;
}

View File

@ -1,3 +1,4 @@
# Created by the script create_makefile
# This is the makefile for compiling a CGAL application.
#---------------------------------------------------------------------#
@ -14,17 +15,22 @@ include $(CGAL_MAKEFILE)
CXXFLAGS = \
$(TESTSUITE_CXXFLAGS) \
$(EXTRA_FLAGS) \
$(CGAL_CXXFLAGS) \
$(LONG_NAME_PROBLEM_CXXFLAGS) \
-g
$(DEBUG_OPT)
#---------------------------------------------------------------------#
# linker flags
#---------------------------------------------------------------------#
LIBPATH = \
$(TESTSUITE_LIBPATH) \
$(CGAL_LIBPATH)
LDFLAGS = \
$(TESTSUITE_LDFLAGS) \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(CGAL_LDFLAGS)
#---------------------------------------------------------------------#
@ -32,20 +38,28 @@ LDFLAGS = \
#---------------------------------------------------------------------#
all: \
in_place_list_prog
in_place_list_prog \
min_element_if_example_noheader \
min_max_element_example_noheader
in_place_list_prog: in_place_list_prog.o
$(CGAL_CXX) -o in_place_list_prog in_place_list_prog.o $(LDFLAGS)
in_place_list_prog$(EXE_EXT): in_place_list_prog$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)in_place_list_prog in_place_list_prog$(OBJ_EXT) $(LDFLAGS)
clean:
rm -f *.o \
in_place_list_prog \
core
min_element_if_example_noheader$(EXE_EXT): min_element_if_example_noheader$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)min_element_if_example_noheader min_element_if_example_noheader$(OBJ_EXT) $(LDFLAGS)
min_max_element_example_noheader$(EXE_EXT): min_max_element_example_noheader$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)min_max_element_example_noheader min_max_element_example_noheader$(OBJ_EXT) $(LDFLAGS)
clean: \
in_place_list_prog.clean \
min_element_if_example_noheader.clean \
min_max_element_example_noheader.clean
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C.o:
$(CGAL_CXX) $(CXXFLAGS) -c $<
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<

View File

@ -0,0 +1,28 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
#include <functional>
using std::vector;
using std::cout;
using std::endl;
using std::modulus;
using std::greater;
using std::compose1;
using std::bind2nd;
using CGAL::min_element_if;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(5);
v.push_back(2);
cout << "min_odd = "
<< *min_element_if(v.begin(),
v.end(),
compose1(bind2nd(greater< int >(), 0),
bind2nd(modulus< int >(), 2)))
<< endl;
return 0;
}

View File

@ -0,0 +1,21 @@
#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
using std::vector;
using std::pair;
using std::cout;
using std::endl;
using CGAL::min_max_element;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(6);
v.push_back(5);
typedef std::vector< int >::iterator iterator;
pair< iterator, iterator > p = min_max_element(v.begin(), v.end());
cout << "min = " << *p.first << ", max = " << *p.second << endl;
return 0;
}

View File

@ -0,0 +1,139 @@
#line 111 "stl_extension.aw"
#line 20 "cgal_header.awi"
// ============================================================================
//
// Copyright (c) 1997, 1998, 1999 The CGAL Consortium
//
// This software and related documentation is part of an INTERNAL release
// of the Computational Geometry Algorithms Library (CGAL). It is not
// intended for general use.
//
// ----------------------------------------------------------------------------
//
// release : $CGAL_Revision: $
// release_date : $CGAL_Date: $
//
// file : algorithm.h
// chapter : $CGAL_Chapter: STL Extensions for CGAL $
// package : $CGAL_Package: STL_Extension $
// source : stl_extension.fw
#line 37 "cgal_header.awi"
// revision : $Revision$
// revision_date : $Date$
// author(s) : Michael Hoffmann <hoffmann@inf.ethz.ch>
// Lutz Kettner <kettner@inf.ethz.ch>
//
// coordinator : INRIA, Sophia Antipolis
//
// STL like algorithms
// ============================================================================
#line 115 "stl_extension.aw"
#ifndef CGAL_ALGORITHM_H
#define CGAL_ALGORITHM_H 1
#include <CGAL/basic.h>
#include <CGAL/copy_n.h>
CGAL_BEGIN_NAMESPACE
#line 1610 "stl_extension.aw"
template < class ForwardIterator >
std::pair< ForwardIterator, ForwardIterator >
min_max_element(ForwardIterator first, ForwardIterator last)
{
typedef std::pair< ForwardIterator, ForwardIterator > FP;
FP result(first, first);
if (first != last)
while (++first != last) {
if (*first < *result.first)
result.first = first;
if (*result.second < *first)
result.second = first;
}
return result;
}
#line 1628 "stl_extension.aw"
template < class ForwardIterator, class CompareMin, class CompareMax >
std::pair< ForwardIterator, ForwardIterator >
min_max_element(ForwardIterator first,
ForwardIterator last,
CompareMin comp_min,
CompareMax comp_max)
{
typedef std::pair< ForwardIterator, ForwardIterator > FP;
FP result(first, first);
if (first != last)
while (++first != last) {
if (comp_min(*first, *result.first))
result.first = first;
if (comp_max(*result.second, *first))
result.second = first;
}
return result;
}
#line 1652 "stl_extension.aw"
template < class ForwardIterator, class Predicate >
ForwardIterator
min_element_if(ForwardIterator first,
ForwardIterator last,
Predicate pred)
{
ForwardIterator result = first;
if (first != last)
while (++first != last)
if (*first < *result && pred(*first))
result = first;
return result;
}
#line 1668 "stl_extension.aw"
template < class ForwardIterator, class Compare, class Predicate >
ForwardIterator
min_element_if(ForwardIterator first,
ForwardIterator last,
Compare comp,
Predicate pred)
{
ForwardIterator result = first;
if (first != last)
while (++first != last)
if (comp(*first, *result) && pred(*first))
result = first;
return result;
}
#line 1685 "stl_extension.aw"
template < class ForwardIterator, class Predicate >
ForwardIterator
max_element_if(ForwardIterator first,
ForwardIterator last,
Predicate pred)
{
ForwardIterator result = first;
if (first != last)
while (++first != last)
if (*result < *first && pred(*first))
result = first;
return result;
}
#line 1701 "stl_extension.aw"
template < class ForwardIterator, class Compare, class Predicate >
ForwardIterator
max_element_if(ForwardIterator first,
ForwardIterator last,
Compare comp,
Predicate pred)
{
ForwardIterator result = first;
if (first != last)
while (++first != last)
if (comp(*result, *first) && pred(*first))
result = first;
return result;
}
#line 124 "stl_extension.aw"
CGAL_END_NAMESPACE
#endif // CGAL_ALGORITHM_H //
// EOF //

View File

@ -1,3 +1,4 @@
# Created by the script create_makefile
# This is the makefile for compiling a CGAL application.
#---------------------------------------------------------------------#
@ -14,17 +15,22 @@ include $(CGAL_MAKEFILE)
CXXFLAGS = \
$(TESTSUITE_CXXFLAGS) \
$(EXTRA_FLAGS) \
$(CGAL_CXXFLAGS) \
$(LONG_NAME_PROBLEM_CXXFLAGS) \
-g
$(DEBUG_OPT)
#---------------------------------------------------------------------#
# linker flags
#---------------------------------------------------------------------#
LIBPATH = \
$(TESTSUITE_LIBPATH) \
$(CGAL_LIBPATH)
LDFLAGS = \
$(TESTSUITE_LDFLAGS) \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(LONG_NAME_PROBLEM_LDFLAGS) \
$(CGAL_LDFLAGS)
#---------------------------------------------------------------------#
@ -35,22 +41,20 @@ all: \
test_In_place_list \
test_stl_extension
test_In_place_list: test_In_place_list.o
$(CGAL_CXX) -o test_In_place_list test_In_place_list.o $(LDFLAGS)
test_In_place_list$(EXE_EXT): test_In_place_list$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)test_In_place_list test_In_place_list$(OBJ_EXT) $(LDFLAGS)
test_stl_extension: test_stl_extension.o
$(CGAL_CXX) -o test_stl_extension test_stl_extension.o $(LDFLAGS)
test_stl_extension$(EXE_EXT): test_stl_extension$(OBJ_EXT)
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)test_stl_extension test_stl_extension$(OBJ_EXT) $(LDFLAGS)
clean:
rm -f *.o \
test_In_place_list \
test_stl_extension \
core
clean: \
test_In_place_list.clean \
test_stl_extension.clean
#---------------------------------------------------------------------#
# suffix rules
#---------------------------------------------------------------------#
.C.o:
$(CGAL_CXX) $(CXXFLAGS) -c $<
.C$(OBJ_EXT):
$(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<

View File

@ -1 +1 @@
2.12 (01 September 1999)
2.13 (01 September 1999)