source: git/factory/templates/ftmpl_factor.cc @ 362fc67

spielwiese
Last change on this file since 362fc67 was 362fc67, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 846 bytes
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#include <factory/templates/ftmpl_factor.h>
4
5template <class T>
6Factor<T>& Factor<T>::operator= ( const Factor<T>& f )
7{
8    if ( this != &f ) {
9        _factor = f._factor;
10        _exp = f._exp;
11    }
12    return *this;
13}
14
15template <class T>
16Factor<T>& Factor<T>::operator= ( const T & f )
17{
18    _factor = f;
19    _exp = 1;
20    return *this;
21}
22
23template <class T>
24int operator== ( const Factor<T> &f1, const Factor<T> &f2 )
25{
26    return (f1.exp() == f2.exp()) && (f1.factor() == f2.factor());
27}
28
29#ifndef NOSTREAMIO
30template <class T>
31void Factor<T>::print ( OSTREAM& s ) const
32{
33    if ( exp() == 1 )
34        s << factor();
35    else
36        s << "(" << factor() << ")^" << exp();
37}
38
39template <class T>
40OSTREAM& operator<< ( OSTREAM & os, const Factor<T> & f )
41{
42    f.print( os );
43    return os;
44}
45#endif /* NOSTREAMIO */
Note: See TracBrowser for help on using the repository browser.