/usr/include/givaro/givelem.h is in libgivaro-dev 3.2.13-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef _GIV_ELEM_H_
#define _GIV_ELEM_H_
// ==========================================================================
// $Source
// Copyright(c)'94-97 by Givaro Team
// see the copyright file.
// Authors: T. Gautier
// $Id
// ==========================================================================
// Description:
// definition of a reference to an object.
//
template<class T>
struct ElemRef {
typedef T Type_t;
T& _ref;
ElemRef( Type_t& ref ) : _ref(ref) {}
operator Type_t& () { return _ref; }
operator const Type_t& () const { return _ref; }
ElemRef<T> operator= (const Type_t& v) { _ref = v; return *this; }
};
template<class T>
struct ElemConstRef {
typedef T Type_t;
const T& _ref;
ElemConstRef( const Type_t& ref ) : _ref(ref) {}
operator const Type_t& () const { return _ref; }
};
template<class T1, class T2>
struct Pair {
T1 _val1;
T2 _val2;
Pair() {}
Pair( const T1& v1, const T2& v2) : _val1(v1), _val2(v2) {}
T1& first() { return _val1; }
const T1& first() const { return _val1; }
T2& second() { return _val2; }
const T2& second() const { return _val2; }
};
template<class T1, class T2>
ostream& operator<< (ostream& o, const Pair<T1,T2>& p )
{ return o << '(' << p._val1 << ',' << p._val2 << ')'; }
template<class T1, class T2>
istream& operator>> (istream& fin, Pair<T1,T2>& p )
{
char ch;
// Skip the first blanks:
fin >> std::ws; fin.get(ch);
if (ch != '(')
GivError::throw_error(
GivBadFormat("operator>><Pair<T1,T2> >: syntax error no '('"));
// - read a T1 + ','
fin >> std::ws >> p._val1;
fin >> std::ws; fin.get(ch);
if (ch != ',')
GivError::throw_error(
GivBadFormat("operator>><Pair<T1,T2> >: syntax error no ','"));
// - read a T1 + ')'
fin >> p._val2;
fin >> std::ws; fin.get(ch);
if (ch != ')')
GivError::throw_error(
GivBadFormat("operator>><Pair<T1,T2> >: syntax error no ')'"));
return fin;
}
#endif
|