SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Pyramid.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
74 #ifndef SLIP_PYRAMID_HPP
75 #define SLIP_PYRAMID_HPP
76 
77 #include <iostream>
78 #include <vector>
79 #include <algorithm>
80 #include "statistics.hpp"
81 #include "Array.hpp"
82 #include "container_cast.hpp"
83 #include <boost/serialization/access.hpp>
84 #include <boost/serialization/split_member.hpp>
85 #include <boost/serialization/string.hpp>
86 #include <boost/serialization/complex.hpp>
87 #include <boost/serialization/vector.hpp>
88 #include <boost/serialization/version.hpp>
89 
90 
91 namespace slip
92 {
93 
94  template<typename Container,typename>
95  struct __container_size
96  {
97  template <typename _II>
98  static std::size_t
99  container_size(_II first, _II last)
100  {
101  return static_cast<std::size_t>(last-first);
102  }
103 
104 };
105 
106 template<typename Container>
107 struct __container_size<Container,std::random_access_iterator_tag>
108 {
109  template <typename _II>
110  static std::size_t
111  container_size(_II first, _II last)
112  {
113  return static_cast<std::size_t>(last-first);
114  }
115 };
116 
117 template<typename Container>
118 struct __container_size<Container,std::random_access_iterator2d_tag>
119 {
120  template <typename _II>
121  static std::size_t
122  container_size(_II first, _II last)
123  {
124  return static_cast<std::size_t>(((last-first)[0])*((last-first)[1]));
125  }
126 };
127 
128 template<typename Container>
129 struct __container_size<Container,std::random_access_iterator3d_tag>
130 {
131  template <typename _II>
132  static std::size_t
133  container_size(_II first, _II last)
134  {
135  return static_cast<std::size_t>(((last-first)[0])*((last-first)[1])*((last-first)[2]));
136  }
137 
138 };
139 
140 
141 template<typename Container>
143 {
144 
146  template<typename Iterator>
147  std::size_t operator() (Iterator first, Iterator last) const
148  {
149  typedef typename std::iterator_traits<Iterator>::iterator_category _Category;
150  return __container_size<Container,_Category>::container_size(first,last);
151  }
152 };
153 
154  //-------------------------------------------------------------
155  // container resolution
156  //--------------------------------------------------------------
157  template<typename Container,typename>
158  struct __container_resolution
159  {
160  template <typename _II>
162  container_resolution(_II first, _II last)
163  {
165  R[0] = static_cast<std::size_t>(last-first);
166  return R;
167  }
168 
169 };
170 
171 template<typename Container>
172 struct __container_resolution<Container,std::random_access_iterator_tag>
173 {
174  template <typename _II>
176  container_resolution(_II first, _II last)
177  {
179  R[0] = static_cast<std::size_t>(last-first);
180  return R;
181  }
182 };
183 
184 template<typename Container>
185 struct __container_resolution<Container,std::random_access_iterator2d_tag>
186 {
187  template <typename _II>
189  container_resolution(_II first, _II last)
190  {
192  R[0] = static_cast<std::size_t>((last-first)[0]);
193  R[1] = static_cast<std::size_t>((last-first)[1]);
194  return R;
195  }
196 };
197 
198 template<typename Container>
199 struct __container_resolution<Container,std::random_access_iterator3d_tag>
200 {
201  template <typename _II>
203  container_resolution(_II first, _II last)
204  {
206  R[0] = static_cast<std::size_t>((last-first)[0]);
207  R[1] = static_cast<std::size_t>((last-first)[1]);
208  R[2] = static_cast<std::size_t>((last-first)[2]);
209 
210  return R;
211  }
212 
213 };
214 
215 
216 template<typename Container>
218 {
219 
221  template<typename Iterator>
222  slip::Array<std::size_t> operator() (Iterator first, Iterator last) const
223  {
224  typedef typename std::iterator_traits<Iterator>::iterator_category _Category;
225  return __container_resolution<Container,_Category>::container_resolution(first,last);
226  }
227 };
228 
229 
230  //--------------------------------------------------------------
231  // container allocator
232  //--------------------------------------------------------------
233 
234 
235  template<typename Container,typename>
236  struct __container_allocator
237  {
238  static Container*
239  container_allocator(const slip::Array<std::size_t>& res)
240  {
241  return new Container(res[0]);
242  }
243 
244 };
245 
246 template<typename Container>
247 struct __container_allocator<Container,std::random_access_iterator_tag>
248 {
249 
250  static Container*
251  container_allocator(const slip::Array<std::size_t>& res)
252  {
253  return new Container(res[0]);
254  }
255 
256 };
257 
258 template<typename Container>
259 struct __container_allocator<Container,std::random_access_iterator2d_tag>
260 {
261  static Container*
262  container_allocator(const slip::Array<std::size_t>& res)
263  {
264  return new Container(res[0],res[1]);
265  }
266 
267 };
268 
269 template<typename Container>
270 struct __container_allocator<Container,std::random_access_iterator3d_tag>
271 {
272  static Container*
273  container_allocator(const slip::Array<std::size_t>& res)
274  {
275  return new Container(res[0],res[1],res[2]);
276  }
277 };
278 
279 
280 template<typename Container>
282 {
283 
285  Container* operator() (const slip::Array<std::size_t>& res) const
286  {
287  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
288  return __container_allocator<Container,_Category>::container_allocator(res);
289  }
290 };
291  //--------------------------------------------------------------
292  // pyramid allocator
293  //--------------------------------------------------------------
294 
295 template<typename Container,typename>
296 struct __pyramid_allocator
297 {
298  template <typename _II>
299  static std::vector<Container*>*
300  pyramid_allocator(_II first, _II last, const std::size_t levels)
301  {
302  assert(levels > 0);
303  assert(slip::power(2,levels-1) <= int(last-first));
304  std::size_t lenght = static_cast<std::size_t>(last-first);
305 
306 
307  std::vector<Container*>* data_ = new std::vector<Container*>(levels);
308  (*data_)[0] = new Container(lenght);
309  std::copy(first,last,((*data_)[0])->begin());
310  for(std::size_t i = 1; i < levels; ++i)
311  {
312  (*data_)[i] = new Container((*data_)[i-1]->size()/2);
313  }
314  return data_;
315  }
316 
317 };
318 
319 template<typename Container>
320 struct __pyramid_allocator<Container,std::random_access_iterator_tag>
321 {
322  template <typename _II>
323  static std::vector<Container*>*
324  pyramid_allocator(_II first, _II last, const std::size_t levels)
325  {
326  assert(levels > 0);
327  assert(slip::power(2,levels-1) <= int(last-first));
328  std::size_t lenght = static_cast<std::size_t>(last-first);
329 
330 
331  std::vector<Container*>* data_ = new std::vector<Container*>(levels);
332  (*data_)[0] = new Container(lenght);
333  std::copy(first,last,((*data_)[0])->begin());
334  for(std::size_t i = 1; i < levels; ++i)
335  {
336  (*data_)[i] = new Container((*data_)[i-1]->size()/2);
337  }
338  return data_;
339  }
340 };
341 
342 template<typename Container>
343 struct __pyramid_allocator<Container,std::random_access_iterator2d_tag>
344 {
345  template <typename _II>
346  static std::vector<Container*>*
347  pyramid_allocator(_II first, _II last,const std::size_t levels)
348  {
349  assert(levels > 0);
350  assert(slip::power(2,levels-1) <= int((last-first)[0]));
351  assert(slip::power(2,levels-1) <= int((last-first)[1]));
352  std::size_t rows = static_cast<std::size_t>((last-first)[0]);
353  std::size_t cols = static_cast<std::size_t>((last-first)[1]);
354 
355 
356  std::vector<Container*>* data_ = new std::vector<Container*>(levels);
357  (*data_)[0] = new Container(rows,cols);
358  std::copy(first,last,((*data_)[0])->begin());
359  for(std::size_t i = 1; i < levels; ++i)
360  {
361  (*data_)[i] = new Container((*data_)[i-1]->rows()/2,(*data_)[i-1]->cols()/2);
362  }
363  return data_;
364  }
365 };
366 
367 template<typename Container>
368 struct __pyramid_allocator<Container,std::random_access_iterator3d_tag>
369 {
370  template <typename _II>
371  static std::vector<Container*>*
372  pyramid_allocator(_II first, _II last,const std::size_t levels)
373  {
374  assert(levels > 0);
375  assert(slip::power(2,levels-1) <= int((last-first)[0]));
376  assert(slip::power(2,levels-1) <= int((last-first)[1]));
377  assert(slip::power(2,levels-1) <= int((last-first)[2]));
378 
379  std::size_t slices = static_cast<std::size_t>((last-first)[0]);
380  std::size_t rows = static_cast<std::size_t>((last-first)[1]);
381  std::size_t cols = static_cast<std::size_t>((last-first)[2]);
382 
383 
384  std::vector<Container*>* data_ = new std::vector<Container*>(levels);
385  (*data_)[0] = new Container(slices,rows,cols);
386  std::copy(first,last,((*data_)[0])->begin());
387  for(std::size_t i = 1; i < levels; ++i)
388  {
389  (*data_)[i] = new Container((*data_)[i-1]->slices()/2,
390  (*data_)[i-1]->rows()/2,
391  (*data_)[i-1]->cols()/2);
392  }
393  return data_;
394  }
395 
396 };
397 
398 
399 template<typename Container>
401 {
402 
404  template<typename Iterator>
405  std::vector<Container*>* operator() (Iterator first, Iterator last, const std::size_t levels) const
406  {
407  typedef typename std::iterator_traits<Iterator>::iterator_category _Category;
408  return __pyramid_allocator<Container,_Category>::pyramid_allocator(first,last,levels);
409  }
410 };
411 
412 //---------------------------------------------
413 //pyramid_copy
414 //--------------------------------------------
415 template<typename Container,typename>
416 struct __pyramid_copy
417 {
418  static std::vector<Container*>*
419  pyramid_copy(const Container& c, const std::size_t levels)
420  {
421  // typedef typename Container::iterator_category _Category;
422  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
423  return __pyramid_allocator<Container,_Category>::pyramid_allocator(c.begin(),c.end(),levels);
424  }
425 
426 };
427 
428 template<typename Container>
429 struct __pyramid_copy<Container,std::random_access_iterator_tag>
430 {
431  static std::vector<Container*>*
432  pyramid_copy(const Container& c, const std::size_t levels)
433  {
434  //typedef typename Container::iterator_category _Category;
435  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
436  return __pyramid_allocator<Container,_Category>::pyramid_allocator(c.begin(),c.end(),levels);
437  }
438 };
439 
440 template<typename Container>
441 struct __pyramid_copy<Container,std::random_access_iterator2d_tag>
442 {
443  static std::vector<Container*>*
444  pyramid_copy(const Container& c,const std::size_t levels)
445  {
446  //typedef typename Container::iterator_category _Category;
447  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
448  return __pyramid_allocator<Container,_Category>::pyramid_allocator(c.upper_left(),c.bottom_right(),levels);
449  }
450 };
451 
452 template<typename Container>
453 struct __pyramid_copy<Container,std::random_access_iterator3d_tag>
454 {
455  static std::vector<Container*>*
456  pyramid_copy(const Container& c, const std::size_t levels)
457  {
458  //typedef typename Container::iterator_category _Category;
459  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
460  return __pyramid_allocator<Container,_Category>::pyramid_allocator(c.front_upper_left(),c.back_bottom_right(),levels);
461  }
462 
463 };
464 
465 
466 template<typename Container>
468 {
469 
471  std::vector<Container*>* operator() (const Container& c,
472  const std::size_t levels) const
473  {
474  // typedef typename Container::iterator_category _Category;
475  typedef typename std::iterator_traits<typename Container::default_iterator>::iterator_category _Category;
476  return __pyramid_copy<Container,_Category>::pyramid_copy(c,levels);
477  }
478 };
479 
480 }//::slip
481 
482 namespace slip
483 {
484 template <typename Container>
485 class Pyramid;
486 
487 template <typename Container>
488 std::ostream& operator<<(std::ostream & out, const slip::Pyramid<Container>& a);
489 
490 template<typename Container>
491 bool operator==(const Pyramid<Container>& x,
492  const Pyramid<Container>& y);
493 
494 template<typename Container>
495 bool operator!=(const Pyramid<Container>& x,
496  const Pyramid<Container>& y);
497 
510 template <class Container>
511 class Pyramid
512 {
513 public:
514  typedef Container value_type;
515  typedef Pyramid<Container> self;
517 
519  typedef value_type const& const_reference;
520 
521  typedef value_type* pointer;
522  typedef value_type const* const_pointer;
523 
524 
525  typedef ptrdiff_t difference_type;
526  typedef std::size_t size_type;
527 
528  typedef pointer iterator;
530 
535 
540  data_(0),
541  levels_(0),
542  base_size_(slip::Array<std::size_t>())
543  {
544  }
545 
566  template<typename Iterator>
567  Pyramid(Iterator init_container_first,
568  Iterator init_container_last,
569  const size_type levels):
570  data_(slip::Pyramid_Allocator<Container>()(init_container_first,
571  init_container_last,
572  levels)),
573  levels_(levels),
574  base_size_(slip::ContainerResolution<Container>()(init_container_first,
575  init_container_last))
576  {
577 
578  // this->data_ = slip::Pyramid_Allocator<Container>()(init_container_first,
579  // init_container_last,
580  // levels);
581  }
585  // Pyramid(const self& rhs):
586  // levels_(rhs.levels_)
587  // {
588  // //allocate
589  // this->data_ = this->data_ = slip::Pyramid_Copy<Container>()(*((*(rhs.data_))[0]),
590  // rhs.levels_);
591  // //copy the data
592  // for(std::size_t i = 0; i < this->levels_; ++i)
593  // {
594  // std::copy(rhs[i].begin(),rhs[i].end(),((*data_)[i])->begin());
595  // }
596  // }
597  Pyramid(const self& rhs):
598  data_(slip::Pyramid_Copy<Container>()(*((*(rhs.data_))[0]),rhs.levels_)),
599  levels_(rhs.levels_),
600  base_size_(rhs.base_size())
601  {
602 
603  //copy the data
604  for(std::size_t i = 0; i < this->levels_; ++i)
605  {
606  std::copy(rhs[i].begin(),rhs[i].end(),((*data_)[i])->begin());
607  }
608  }
609 
614  {
615  this->desallocate();
616  }
617 
618 
631  self& operator=(const self& rhs)
632  {
633  if(this != &rhs)
634  {
635  if((this->levels_ != rhs.levels_) ||
636  (((*data_)[0])->size() != ((*(rhs.data_))[0])->size()))
637  {
638  this->desallocate();
639  this->levels_ = rhs.levels_;
640  this->base_size_ = rhs.base_size();
641  this->data_ = slip::Pyramid_Copy<Container>()(*((*(rhs.data_))[0]),
642  rhs.levels_);
643  }
644  for(std::size_t i = 0; i < this->levels_; ++i)
645  {
646  std::copy(rhs[i].begin(),rhs[i].end(),((*data_)[i])->begin());
647  }
648  }
649  return *this;
650  }
661  {
662  return this->levels_;
663  }
664 
666  {
667  return this->base_size_;
668  }
688  {
689  assert(n < this->levels());
690  return *((*data_)[n]);
691  }
692 
693 
706  {
707  assert(n < this->levels());
708  return *((*data_)[n]);
709  }
721  friend std::ostream& operator<< <>(std::ostream & out,
722  const self& a);
723 
729  size_type size() const
730  {
731  return data_->size();
732  }
737  {
738  return data_->max_size();
739  }
740 
744  bool empty()const
745  {
746  return data_->empty();
747  }
748 
753  void swap(self& rhs)
754  {
755  assert((this->levels_ == rhs.levels_) && (((*data_)[0])->size() == ((*(rhs.data_))[0])->size()));
756  for(std::size_t i = 0; i < this->levels_; ++i)
757  {
758  (*(*rhs.data_)[i]).swap(*((*data_)[i]));
759  }
760  }
761 
766  void fill(const typename Container::value_type& val)
767  {
768  for(std::size_t i = 0; i < this->levels_; ++i)
769  {
770  std::fill(((*data_)[i])->begin(),((*data_)[i])->end(),val);
771  }
772  }
773 
784  friend bool operator== <>(const Array<Container>& x,
785  const Array<Container>& y);
786 
793  friend bool operator!= <>(const Array<Container>& x,
794  const Array<Container>& y);
795 
798 private:
799  std::vector<Container* >* data_;
800  std::size_t levels_;
801  slip::Array<std::size_t> base_size_;
802 
803 
804  void desallocate()
805  {
806  if(this->data_ != 0)
807  {
808  for(std::size_t i = 0; i < this->levels_; ++i)
809  {
810  if((*data_)[i] != 0)
811  {
812  delete (*data_)[i];
813  }
814  }
815  delete this->data_;
816  }
817  }
818 
820  template<class Archive>
821  void save(Archive & ar, const unsigned int version) const
822  {
823  ar & this->levels_;
824  ar & this->base_size_;
825  //ar & this->data_;
826  for(std::size_t l = 0; l < this->levels_;++l)
827  {
828  ar & *((*data_)[l]);
829  }
830 
831  }
832  template<class Archive>
833  void load(Archive & ar, const unsigned int version)
834  {
835  // std::cout<<"read levels"<<std::endl;
836  ar & this->levels_;
837  //std::cout<<"read base_size"<<std::endl;
838  ar & this->base_size_;
839  //std::cout<<"desallocate"<<std::endl;
840  this->desallocate();
841  Container* cont = slip::ContainerAllocator<Container>()(this->base_size_);
842  std::cout<<"this->base_size_ "<<this->base_size_<<std::endl;
843  //std::cout<<"cont->size() "<<cont->size()<<std::endl;
844  typename Container::default_iterator first;
845  typename Container::default_iterator last;
846  slip::container_cast(*cont,first,last);
847  std::cout<<"last-first = "<<(last-first)<<std::endl;
848  this->data_ = slip::Pyramid_Allocator<Container>()(first,
849  last,
850  this->levels_);
851  for(std::size_t l = 0; l < this->levels_;++l)
852  {
853  ar & *((*data_)[l]);
854  }
855  delete cont;
856  }
857  BOOST_SERIALIZATION_SPLIT_MEMBER();
858 };
859 
860 } //slip::
861 
862 
863 namespace slip
864 {
865 
866  template <typename Container>
867  inline
868  std::ostream& operator<<(std::ostream & out, const slip::Pyramid<Container>& a)
869  {
870  out<<"Pyramid levels : "<<a.levels_<<std::endl;
871  out<<"Pyramid base size : "<<a.base_size_<<std::endl;
872  for(std::size_t i = 0; i < a.levels_; ++i)
873  {
874  out<<"Level "<<i<<std::endl;
875  out<<*((*a.data_)[i])<<std::endl;
876  }
877  return out;
878  }
879 
880 }//slip::
881 
882 namespace slip
883 {
884  template<typename Container>
886  const Pyramid<Container>& y)
887 {
888 
889  if (x.size() != y.size())
890  {
891  return false;
892  }
893  typedef typename slip::Pyramid<Container>::size_type size_type;
894  const size_type size = x.size();
895  for (size_type i = 0; i < size; ++i)
896  {
897  if (!(x[i] == y[i]))
898  {
899  return false;
900  }
901  }
902  return true;
903 }
904 
905 template<typename Container>
907  const Pyramid<Container>& y)
908 {
909  return !(x == y);
910 }
911 
912 }//::slip
913 
914 #endif // SLIP_PYRAMID_HPP
void container_cast(Container &cont, _II &first, _II &last)
Get the default iterators of a SLIP container.
bool operator!=(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1448
friend class boost::serialization::access
Definition: Pyramid.hpp:819
const slip::Array< size_type > & base_size() const
Definition: Pyramid.hpp:665
size_type levels() const
Definition: Pyramid.hpp:660
const_pointer const_iterator
Definition: Pyramid.hpp:529
Pyramid()
Constructs a Pyramid with no data and zero levels.
Definition: Pyramid.hpp:539
self & operator=(const self &rhs)
Assigns rhs to the Pyramid.
Definition: Pyramid.hpp:631
T power(T x, Integer N)
function to compute.
Definition: macros.hpp:368
~Pyramid()
Destructor of the Pyramid.
Definition: Pyramid.hpp:613
Pyramid(Iterator init_container_first, Iterator init_container_last, const size_type levels)
Constructs a Pyramid of levels level and copy the finest level (0 level) with the range [init_contain...
Definition: Pyramid.hpp:567
void fill(const typename Container::value_type &val)
Fill all the container of the Pyramid with val.
Definition: Pyramid.hpp:766
value_type const * const_pointer
Definition: Pyramid.hpp:522
ptrdiff_t difference_type
Definition: Pyramid.hpp:525
bool empty() const
Returns true if the Pyramid is empty. (Thus size() == 0)
Definition: Pyramid.hpp:744
void swap(self &rhs)
Swaps data with another Pyramid.
Definition: Pyramid.hpp:753
value_type & reference
Definition: Pyramid.hpp:518
Container * operator()(const slip::Array< std::size_t > &res) const
Definition: Pyramid.hpp:285
const_reference operator[](const size_type n) const
Subscript access to the data contained in the Pyramid.
Definition: Pyramid.hpp:705
This is container to handle a pyramid of containers.
Definition: Pyramid.hpp:485
Provides a class to manipulate 1d dynamic and generic arrays.
reference operator[](const size_type n)
Subscript access to the data contained in the Pyramid.
Definition: Pyramid.hpp:687
std::vector< Container * > * operator()(Iterator first, Iterator last, const std::size_t levels) const
Definition: Pyramid.hpp:405
Provides some statistics algorithms.
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
Definition: copy_ext.hpp:177
std::size_t size_type
Definition: Pyramid.hpp:526
pointer iterator
Definition: Pyramid.hpp:528
value_type const & const_reference
Definition: Pyramid.hpp:519
value_type * pointer
Definition: Pyramid.hpp:521
std::size_t operator()(Iterator first, Iterator last) const
Definition: Pyramid.hpp:147
std::vector< Container * > * operator()(const Container &c, const std::size_t levels) const
Definition: Pyramid.hpp:471
Container value_type
Definition: Pyramid.hpp:514
size_type size() const
Returns the number of containers in the Pyramid.
Definition: Pyramid.hpp:729
size_type max_size() const
Returns the maximal size (number of container) in the Pyramid.
Definition: Pyramid.hpp:736
bool operator==(const Array< T > &x, const Array< T > &y)
Definition: Array.hpp:1439
Pyramid(const self &rhs)
Constructs a copy of the Pyramid rhs.
Definition: Pyramid.hpp:597
slip::Array< std::size_t > operator()(Iterator first, Iterator last) const
Definition: Pyramid.hpp:222
Provides some algorithms to get the default iterators associated with containers. ...
const Pyramid< Container > const_self
Definition: Pyramid.hpp:516