My Project
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
ftmpl_list.h File Reference
#include <iostream>

Go to the source code of this file.

Data Structures

class  ListItem< T >
 
class  List< T >
 
class  ListIterator< T >
 

Macros

#define OSTREAM   std::ostream
 

Functions

template<class T >
OSTREAMoperator<< (OSTREAM &, const List< T > &)
 
template<class T >
int operator== (const List< T > &, const List< T > &)
 
template<class T >
List< TUnion (const List< T > &, const List< T > &)
 
template<class T >
List< TDifference (const List< T > &, const List< T > &)
 
template<class T >
List< TUnion (const List< T > &, const List< T > &, int(*ecmpf)(const T &, const T &))
 
template<class T >
List< TDifference (const List< T > &, const List< T > &, int(*ecmpf)(const T &, const T &))
 
template<class T >
List< TDifference (const List< T > &F, const T &G)
 
template<class T >
List< TDifference (const List< T > &F, const T &G, int(*ecmpf)(const T &, const T &))
 
template<class T >
List< TUnion (const List< T > &, const List< T > &, int(*cmpf)(const T &, const T &), void(*insf)(T &, const T &))
 
template<class T >
T prod (const List< T > &)
 
template<class T >
bool find (const List< T > &, const T &t)
 
template<class T >
bool find (const List< T > &F, const T &t, int(*ecmpf)(const T &, const T &))
 

Macro Definition Documentation

◆ OSTREAM

#define OSTREAM   std::ostream

Definition at line 9 of file ftmpl_list.h.

Function Documentation

◆ Difference() [1/4]

template<class T >
List< T > Difference ( const List< T > &  F,
const List< T > &  G 
)

Definition at line 622 of file ftmpl_list.cc.

623{
624 List<T> L;
626 T f;
627 int found;
628 for ( i = F; i.hasItem(); ++i )
629 {
630 f = i.getItem();
631 found = 0;
632 for ( j = G; j.hasItem() && (!found); ++j )
633 found = f == j.getItem();
634 if ( ! found )
635 L.append( f );
636 }
637 return L;
638}
int i
Definition: cfEzgcd.cc:132
FILE * f
Definition: checklibs.c:9
void append(const T &)
Definition: ftmpl_list.cc:256
bool found
Definition: facFactorize.cc:55
int j
Definition: facHensel.cc:110
STATIC_VAR jList * T
Definition: janet.cc:30
STATIC_VAR TreeM * G
Definition: janet.cc:31

◆ Difference() [2/4]

template<class T >
List< T > Difference ( const List< T > &  F,
const List< T > &  G,
int(*)(const T &, const T &)  ecmpf 
)

Definition at line 641 of file ftmpl_list.cc.

642{
643 List<T> L;
645 T f;
646 int found;
647 for ( i = F; i.hasItem(); ++i )
648 {
649 f = i.getItem();
650 found = 0;
651 for ( j = G; j.hasItem() && (!found); ++j )
652 found = ecmpf (f, j.getItem());
653 if ( ! found )
654 L.append( f );
655 }
656 return L;
657}

◆ Difference() [3/4]

template<class T >
List< T > Difference ( const List< T > &  F,
const T G 
)

Definition at line 675 of file ftmpl_list.cc.

676{
677 List<T> L;
679 int found;
680 for ( i = F; i.hasItem(); ++i )
681 {
682 found = G == i.getItem();
683 if ( ! found )
684 L.append( i.getItem() );
685 }
686 return L;
687}

◆ Difference() [4/4]

template<class T >
List< T > Difference ( const List< T > &  F,
const T G,
int(*)(const T &, const T &)  ecmpf 
)

Definition at line 660 of file ftmpl_list.cc.

661{
662 List<T> L;
664 int found;
665 for ( i = F; i.hasItem(); ++i )
666 {
667 found = ecmpf (G, i.getItem());
668 if ( ! found )
669 L.append( i.getItem() );
670 }
671 return L;
672}

◆ find() [1/2]

template<class T >
bool find ( const List< T > &  F,
const T t 
)

Definition at line 700 of file ftmpl_list.cc.

701{
702 if (F.length() == 0) return false;
703 ListIterator<T> J= F;
704 while (J.hasItem())
705 {
706 if (J.getItem() == t)
707 return true;
708 J++;
709 }
710 return false;
711}
T & getItem() const
Definition: ftmpl_list.cc:431
int length() const
Definition: ftmpl_list.cc:273

◆ find() [2/2]

template<class T >
bool find ( const List< T > &  F,
const T t,
int(*)(const T &, const T &)  ecmpf 
)

Definition at line 714 of file ftmpl_list.cc.

715{
716 if (F.length() == 0) return false;
717 ListIterator<T> J= F;
718 while (J.hasItem())
719 {
720 if (ecmpf (J.getItem(), t))
721 return true;
722 J++;
723 }
724 return false;
725}

◆ operator<<()

template<class T >
OSTREAM & operator<< ( OSTREAM os,
const List< T > &  l 
)

Definition at line 555 of file ftmpl_list.cc.

556{
557 l.print( os );
558 return os;
559}
int l
Definition: cfEzgcd.cc:100

◆ operator==()

template<class T >
int operator== ( const List< T > &  l1,
const List< T > &  l2 
)

Definition at line 176 of file ftmpl_list.cc.

177{
178 if (l1.length() != l2.length())
179 return 0;
180 ListIterator<T> iter2= l2;
181 for (ListIterator<T> iter1= l1; iter1.hasItem(); iter1++)
182 {
183 if (!(iter1.getItem() == iter2.getItem()))
184 return 0;
185 iter2++;
186 }
187
188 return 1;
189}

◆ prod()

template<class T >
T prod ( const List< T > &  F)

Definition at line 690 of file ftmpl_list.cc.

691{
693 T p = 1;
694 for ( i = F; i.hasItem(); i++ )
695 p *= i.getItem();
696 return p;
697}
int p
Definition: cfModGcd.cc:4078

◆ Union() [1/3]

template<class T >
List< T > Union ( const List< T > &  F,
const List< T > &  G 
)

Definition at line 563 of file ftmpl_list.cc.

564{
565 List<T> L = G;
567 T f;
568 bool iselt;
569
570 for ( i = F; i.hasItem(); i++ )
571 {
572 f = i.getItem();
573 iselt = false;
574 j = G;
575 while ( ( ! iselt ) && j.hasItem() )
576 {
577 iselt = f == j.getItem();
578 j++;
579 }
580 if ( ! iselt )
581 L.append( f );
582 }
583 return L;
584}

◆ Union() [2/3]

template<class T >
List< T > Union ( const List< T > &  F,
const List< T > &  G,
int(*)(const T &, const T &)  cmpf,
void(*)(T &, const T &)  insf 
)

Definition at line 587 of file ftmpl_list.cc.

588{
589 List<T> L = G;
591
592 for ( i = F; i.hasItem(); ++i )
593 L.insert( i.getItem(), cmpf, insf );
594 return L;
595}
void insert(const T &)
Definition: ftmpl_list.cc:193

◆ Union() [3/3]

template<class T >
List< T > Union ( const List< T > &  F,
const List< T > &  G,
int(*)(const T &, const T &)  ecmpf 
)

Definition at line 598 of file ftmpl_list.cc.

599{
600 List<T> L = G;
602 T f;
603 bool iselt;
604
605 for ( i = F; i.hasItem(); i++ )
606 {
607 f = i.getItem();
608 iselt = false;
609 j = G;
610 while ( ( ! iselt ) && j.hasItem() )
611 {
612 iselt = ecmpf (f, j.getItem());
613 j++;
614 }
615 if ( ! iselt )
616 L.append( f );
617 }
618 return L;
619}