/usr/include/CGAL/Exponent_vector.h is in libcgal-dev 4.11-2build1.
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | // Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Michael Hemmer
//
// ============================================================================
#ifndef CGAL_EXPONENT_VECTOR_H
#define CGAL_EXPONENT_VECTOR_H
#include <deque>
#include <iterator>
#include <algorithm>
#include <vector>
#include <CGAL/assertions.h>
#include <CGAL/use.h>
#include <CGAL/int.h>
#include <boost/operators.hpp>
#include <boost/type_traits/is_same.hpp>
namespace CGAL {
class Exponent_vector :
public boost::less_than_comparable1< Exponent_vector >,
public boost::equality_comparable1< Exponent_vector >
{
std::vector<int> v;
public:
typedef Exponent_vector Self;
Exponent_vector(){};
Exponent_vector(int e0): v(1) {
v[0]=e0;
};
Exponent_vector(int e0, int e1): v(2) {
v[0]=e0; v[1]=e1;
};
Exponent_vector(int e0, int e1, int e2): v(3) {
v[0]=e0; v[1]=e1; v[2]=e2;
};
Exponent_vector(int e0, int e1, int e2, int e3): v(4) {
v[0]=e0; v[1]=e1; v[2]=e2; v[3]=e3;
};
Exponent_vector(const std::vector<int>& v_): v(v_){};
Exponent_vector(const Exponent_vector& ev): v(ev.v){};
template <class InputIterator>
Exponent_vector(InputIterator begin , InputIterator end)
:v(begin,end){
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
CGAL_USE_TYPE(value_type);
CGAL_static_assertion(( ::boost::is_same<value_type, int>::value));
}
// mirror vector functions
typedef std::vector<int>::value_type value_type;
typedef std::vector<int>::pointer pointer;
typedef std::vector<int>::const_pointer const_pointer;
typedef std::vector<int>::reference reference;
typedef std::vector<int>::const_reference const_reference;
typedef std::vector<int>::size_type size_type;
typedef std::vector<int>::difference_type difference_type;
typedef std::vector<int>::iterator iterator;
typedef std::vector<int>::const_iterator const_iterator;
typedef std::vector<int>::reverse_iterator reverse_iterator;
typedef std::vector<int>::const_reverse_iterator const_reverse_iterator;
iterator begin(){return v.begin();}
iterator end(){return v.end();}
const_iterator begin() const {return v.begin();}
const_iterator end() const {return v.end();}
reverse_iterator rbegin() {return v.rbegin();}
reverse_iterator rend(){return v.rend();}
const_reverse_iterator rbegin() const {return v.rbegin();}
const_reverse_iterator rend() const {return v.rend();}
size_type size() const {return v.size();}
size_type max_size() const {return v.max_size();}
size_type capacity() const {return v.capacity();}
bool empty() const {return v.empty();}
reference operator[](size_type n) { return v[n]; }
const_reference operator[](size_type n) const {return v[n];}
// vector& operator=(const vector&)
void reserve(size_t s){v.reserve(s);}
reference front(){return v.front();}
const_reference front() const {return v.front();}
reference back() {return v.back();}
const_reference back() const {return v.back();}
void push_back(const int& x) { v.push_back(x);}
void pop_back() {v.pop_back();}
void swap(Self& ev) {v.swap(ev.v);}
iterator insert(iterator pos, const int& x){return v.insert(pos,x);}
template <class InputIterator>
void insert(iterator pos,InputIterator f, InputIterator l){
v.insert(pos,f,l);
}
void insert(iterator pos, size_type n, const int& x){
v.insert(pos,n,x);
}
iterator erase(iterator pos){return v.erase(pos);}
iterator erase(iterator first, iterator last){return v.erase(first,last);}
void clear(){v.clear();}
void resize(size_type n, int t = 0){v.resize(n,t);}
bool operator==(const Self& ev) const { return v == ev.v; }
// this is the actual change
bool operator<( const Exponent_vector& ev ) const {
return std::lexicographical_compare (
this->rbegin(), this->rend(), ev.rbegin(), ev.rend());
}
void output_benchmark( std::ostream& os ) const {
os << "( ";
for( unsigned i = 0; i < size(); ++i ) {
if( i != 0 )
os << ", ";
os << v.at(i);
}
os << " )";
}
};
inline bool is_valid(const Exponent_vector& ev) {
Exponent_vector::const_iterator it;
for(it = ev.begin(); it != ev.end();it++){
if (CGAL::is_negative(*it)) return false;
}
return true;
}
inline std::ostream& operator << (std::ostream& os, const Exponent_vector& ev) {
Exponent_vector::const_iterator it;
os << "(" ;
for(it = ev.begin(); it != ev.end();it++){
if (it == ev.begin()) {
os << *it ;
}
else{
os <<"," << *it ;
}
}
os << ")" ;
return os;
}
} //namespace CGAL
namespace std{
template <> inline
void swap(CGAL::Exponent_vector& ev1, CGAL::Exponent_vector& ev2){
ev1.swap(ev2);
}
}
#endif // CGAL_EXPONENT_VECTOR_H
|