ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
block_ulong.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010, 2011, 2012, 2014, 2024 John D Lamb
3 * Enum copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef CCGSL_BLOCK_ULONG_HPP
21#define CCGSL_BLOCK_ULONG_HPP
22
23#include<gsl/gsl_block.h>
24#include<new>
25#include<iterator>
26#include<cstring>
27#include<cstddef>
28#ifdef __GXX_EXPERIMENTAL_CXX0X__
29#include<initializer_list>
30#endif
31
32#include"exception.hpp"
33
34// This file is autogenerated
35
36namespace gsl {
42 public:
47 ccgsl_pointer = 0;
48 count = 0; // initially nullptr will do
49 }
50 // Refines random access container
51 // Refines assignable
56 explicit block_ulong( size_t const n ){
57 if( n > 0 )
58 ccgsl_pointer = gsl_block_ulong_alloc( n );
59 else {
60 ccgsl_pointer = new gsl_block_ulong;
61 ccgsl_pointer->size = 0;
62 ccgsl_pointer->data = 0;
63 }
64 // just plausibly we could allocate block_ulong but not count
65 try { count = new size_t; } catch( std::bad_alloc& e ){
66 // try to tidy up before rethrowing
67 if( n > 0 ) gsl_block_ulong_free( ccgsl_pointer );
68 else delete ccgsl_pointer;
69 throw e;
70 }
71 *count = 1; // initially there is just one reference to ccgsl_pointer
72 }
78 explicit block_ulong( gsl_block_ulong* v ){
79 ccgsl_pointer = v;
80 // just plausibly we could fail to allocate count: no further action needed.
81 count = new size_t;
82 *count = 1; // initially there is just one reference to ccgsl_pointer
83 }
84#ifdef __GXX_EXPERIMENTAL_CXX0X__
89 block_ulong( std::initializer_list<unsigned long> initializer_list ){
90 size_t const n = initializer_list.size();
91 ccgsl_pointer = gsl_block_ulong_alloc( n );
92 // just plausibly we could allocate vector_ulong but not count
93 try { count = new size_t; } catch( std::bad_alloc& e ){
94 // try to tidy up before rethrowing
95 if( n > 0 ) gsl_block_ulong_free( ccgsl_pointer );
96 else delete ccgsl_pointer;
97 throw e;
98 }
99 *count = 1; // initially there is just one reference to ccgsl_pointer
100 // now copy
101 auto p = begin();
102 for( auto x : initializer_list ){ *p = x; ++p; }
103 }
104#endif
105 // copy constructor
111 if( count != 0 ) ++*count; // block_ulong is now shared.
112 }
113 // assignment operator
119 // first, possibly delete anything pointed to by this
120 if( count == 0 or --*count == 0 ){
121 if( ccgsl_pointer != 0 ){
122 if( ccgsl_pointer->size > 0 ) gsl_block_ulong_free( ccgsl_pointer );
123 else delete ccgsl_pointer; }
124 delete count;
125 }
126 // Then copy
128 count = v.count;
129 if( count != 0 ) ++*count; // block_ulong is now shared.
130 return *this;
131 }
132 // clone()
139 block_ulong copy( ccgsl_pointer->size );
140 // Now copy
141 memcpy( copy.ccgsl_pointer->data, ccgsl_pointer->data, ccgsl_pointer->size * sizeof( unsigned long ) );
142 // return new object
143 return copy;
144 }
145 // destructor
150 if( count == 0 or --*count == 0 ){
151 // could have allocated null pointer
152 if( ccgsl_pointer != 0 ){
153 if( ccgsl_pointer->size > 0 ) gsl_block_ulong_free( ccgsl_pointer );
154 else delete ccgsl_pointer; }
155 delete count;
156 }
157 }
161 void reset(){ block_ulong().swap( *this ); }
162#ifdef __GXX_EXPERIMENTAL_CXX0X__
168 std::swap( count, v.count );
169 v.ccgsl_pointer = nullptr;
170 }
177 block_ulong( std::move( v ) ).swap( *this );
178 return *this;
179 }
180#endif
181 // Refines equality comparable
182 // == operator
189 bool operator==( block_ulong const& v ) const {
190 // trivially equal if gsl_block_ulong*s are identical
191 if( ccgsl_pointer == v.ccgsl_pointer ) return true;
192 // trivially not equal if one is zero: != should be same as xor here
193 if( (ccgsl_pointer == 0) != (v.ccgsl_pointer == 0 ) ) return false;
194 // trivially not equal if sizes are different
195 if( ccgsl_pointer->size != v.ccgsl_pointer->size ) return false;
196 // check elementwise for equality
197 for( size_t i = 0; i < ccgsl_pointer->size; ++i )
198 if( ccgsl_pointer->data[i] != v.ccgsl_pointer->data[i] ) return false;
199 return true;
200 }
201 // != operator
208 bool operator!=( block_ulong const& v ) const { return not operator==( v ); }
209 // Refines forward container
210 // Refines less than comparable
211 // operator<
220 bool operator<( block_ulong const& v ) const {
221 // null block_ulong comes first
222 if( ccgsl_pointer == 0 ) return v.ccgsl_pointer != 0;
223 // if v is null then this > v
224 if( v.ccgsl_pointer == 0 ) return false;
225 // Now compare elementwise
226 size_t const size = ccgsl_pointer->size;
227 size_t const v_size = v.ccgsl_pointer->size;
228 size_t const min = size > v_size ? size : v_size;
229 for( size_t i = 0; i < min; ++i ){
230 unsigned long const t = ccgsl_pointer->data[i];
231 unsigned long const u =v.ccgsl_pointer->data[i];
232 if( t < u ) return true;
233 if( u < t ) return false;
234 }
235 // elements match.
236 return size < v_size;
237 }
238 // operator>
247 bool operator>( block_ulong const& v ) const {
248 // null block_ulong comes first
249 if( ccgsl_pointer == 0 ) return false;
250 // if v is null then this > v
251 if( v.ccgsl_pointer == 0 ) return true;
252 // Now compare elementwise
253 size_t const size = ccgsl_pointer->size;
254 size_t const v_size = v.ccgsl_pointer->size;
255 size_t const min = size > v_size ? size : v_size;
256 for( size_t i = 0; i < min; ++i ){
257 unsigned long const t = ccgsl_pointer->data[i];
258 unsigned long const u =v.ccgsl_pointer->data[i];
259 if( t > u ) return true;
260 if( u > t ) return false;
261 }
262 // elements match.
263 return size > v_size;
264 }
265 // operator<=
274 bool operator<=( block_ulong const& v ) const {
275 return operator<( v ) or operator==( v );
276 }
277 // operator>=
286 bool operator>=( block_ulong const& v ) const {
287 return operator>( v ) or operator==( v );
288 }
289 // Refines container
290 // type value_type
294 typedef unsigned long value_type;
295 // type reference
300 // type const_reference
305 // type pointer
310 // type const_pointer
314 typedef value_type const* const_pointer;
315 // type iterator
316 private:
321 template<typename container, typename content, bool reverse> class iterator_base {
322 friend class block_ulong;
323 public:
327 typedef std::random_access_iterator_tag iterator_category;
331 typedef unsigned long value_type;
340 // // type iterator_traits<block_ulong>::difference_type
344 typedef ptrdiff_t difference_type;
345 public:
346 // // operator*
352 // Always try to return something
353 static content something = 0;
354 // First check that iterator is initialised.
355 if( v == 0 ){
356 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAULT );
357 return something;
358 } else if( v->ccgsl_pointer == 0 ){
359 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAULT );
360 return something;
361 }
362 // Check that position make sense
363 if( position >= static_cast<difference_type>( v->size() ) ){
364 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
365 return something;
366 }
367 if( position <= -1 ){
368 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
369 return something;
370 }
371 // position and v are valid: return data
372 return *(v->ccgsl_pointer->data + position);
373 }
374 // // operator->
380 // First check that iterator is initialised.
381 if( v == 0 ){
382 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
383 return 0;
384 } else if( v->ccgsl_pointer == 0 ){
385 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
386 return 0;
387 }
388 // Check that position make sense
389 if( position >= static_cast<difference_type>( v->size() ) ){
390 gsl_error( "trying to dereference end()", __FILE__, __LINE__, exception::GSL_EFAILED );
391 return 0;
392 }
393 if( position <= -1 ){
394 gsl_error( "trying to dereference rend()", __FILE__, __LINE__, exception::GSL_EFAILED );
395 return 0;
396 }
397 // position and v are valid: return data
398 return v->ccgsl_pointer->data + position;
399 }
400 // // operator[]
407 // Always try to return something
408 static content something = 0;
409 // First check that iterator is initialised.
410 if( v == 0 ){
411 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
412 return something;
413 } else if( v->ccgsl_pointer == 0 ){
414 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
415 return something;
416 }
417 // Check that position make sense
418 difference_type const p = reverse ? position - n : position + n;
419 if( p >= static_cast<difference_type>( v->size() ) ){
420 gsl_error( "trying to dereference beyond rbegin()", __FILE__, __LINE__, exception::GSL_EFAILED );
421 return something;
422 }
423 if( p <= -1 ){
424 gsl_error( "trying to dereference beyond begin()", __FILE__, __LINE__, exception::GSL_EFAILED );
425 return something;
426 }
427 // p is a valid position
428 return *(v->ccgsl_pointer->data + p);
429 }
430 // // operator-: find distance between two iterators
437 // Warn if either iterator undefined
438 if( v == 0 or i.v == 0 ){
439 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
440 return 0;
441 } else if( v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
442 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
443 return 0;
444 }
445 // Warn if iterators do not point to same block_ulong
446 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
447 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
449 return 0;
450 }
451 return reverse ? i.position - position : position - i.position;
452 }
453 // // operator!=
454 // // operator<
461 return this->v == i.v and this->position == i.position;
462 }
469 return not this->operator==( i );
470 }
479 // Warn if either iterator undefined
480 if( v == 0 or i.v == 0 ){
481 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
482 return false;
483 }
484 // Warn if iterators do not point to same block_ulong
485 if( v->ccgsl_pointer != i.v->ccgsl_pointer ){
486 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
488 return false;
489 }
490 return reverse ? i.position < position : position < i.position;
491 }
492 protected:
497 void increment(){
498 // Only makes sense if v points to a block_ulong
499 if( v == 0 ){
500 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
501 return;
502 } else if( v->ccgsl_pointer == 0 ){
503 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
504 return;
505 }
506 // increment position and check against size
507 if( reverse ){ if( position >= 0 ) --position; }
508 else { if( position < static_cast<difference_type>( v->size() ) ) ++position; }
509 }
514 void decrement(){
515 // Only makes sense if v points to a block_ulong
516 if( v == 0 ){
517 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
518 return;
519 } else if( v->ccgsl_pointer == 0 ){
520 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
521 return;
522 }
523 // decrement position and check against size
524 if( reverse ){ if( position < static_cast<difference_type>( v->size() ) ) ++position; }
525 else { if( position >= 0 ) --position; }
526 }
531 void shift( difference_type const n ){
532 // Warn if iterator undefined
533 if( v == 0 ){
534 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
535 return;
536 } else if( v->ccgsl_pointer == 0 ){
537 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
538 return;
539 }
540 position += reverse ? -n : n;
541 }
545 iterator_base(){ v = 0; }
552 : v( v ), position( position ){}
556 container* v;
561 };
562 // Need to know about const_iterator_t
563 template<bool reverse> class const_iterator_t;
567 template<bool reverse> class iterator_t : public iterator_base<block_ulong,unsigned long,reverse>{
568 public:
569 // // Refines output iterator
570 // // operator=
578 return *this;
579 }
580 // // Refines forward iterator
581 // // operator++ (both)
588 return *this;
589 }
595 // return value
598 return result;
599 }
600 // // Refines bidirectional iterator
601 // // operator-- (both)
608 return *this;
609 }
615 // return value
618 return result;
619 }
625 // // operator+=
632 this->shift( n );
633 return *this;
634 }
635 // // operator-=
642 this->shift( -n );
643 return *this;
644 }
645 // // operator+ (n+i)(i+n)
654 result.shift( n );
655 return result;
656 }
657 // // operator- (n-i)(i-n)(i-j)
666 result.shift( -n );
667 return result;
668 }
676 }
683 // Warn if either iterator undefined
684 if( this->v == 0 or i.v == 0 ){
685 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
686 return 0;
687 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
688 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
689 return 0;
690 }
691 // Warn if iterators do not point to same block_ulong
692 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
693 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
695 return 0;
696 }
697 return reverse ? i.position - this->position : this->position - i.position;
698 }
704 bool operator==( const_iterator_t<reverse> const& i ) const {
705 return this->v == i.v and this->position == i.position;
706 }
712 bool operator!=( const_iterator_t<reverse> const& i ) const {
713 return not this->operator==( i );
714 }
720 bool operator<( const_iterator_t<reverse> const& i ) const {
721 // Warn if either iterator undefined
722 if( this->v == 0 or i.v == 0 ){
723 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
724 return false;
725 }
726 // Warn if iterators do not point to same block_ulong
727 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
728 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
730 return false;
731 }
732 return reverse ? i.position < this->position : this->position < i.position;
733 }
737 iterator_t() : iterator_base<block_ulong,unsigned long,reverse>(){}
738 protected:
739 friend class block_ulong;
740 // We need a constructor for block_ulong
747 : iterator_base<block_ulong,unsigned long,reverse>( v, position ){}
748 };
752 template<bool reverse> class const_iterator_t
753 : public iterator_base<block_ulong const,unsigned long,reverse>{
754 public:
755 // // Refines output iterator
756 // // operator=
764 return *this;
765 }
766 // // Refines forward iterator
767 // // operator++ (both)
774 return *this;
775 }
781 // return value
784 return result;
785 }
786 // // Refines bidirectional iterator
787 // // operator-- (both)
794 return *this;
795 }
801 // return value
804 return result;
805 }
811 // // operator+=
818 this->shift( n );
819 return *this;
820 }
821 // // operator-=
828 this->shift( -n );
829 return *this;
830 }
831 // // operator+ (n+i)(i+n)
840 result += n;
841 return result;
842 }
843 // // operator- (n-i)(i-n)(i-j)
852 result -= n;
853 return result;
854 }
862 }
869 // Warn if either iterator undefined
870 if( this->v == 0 or i.v == 0 ){
871 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
872 return 0;
873 } else if( this->v->ccgsl_pointer == 0 or i.v->ccgsl_pointer == 0 ){
874 gsl_error( "block_ulong not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
875 return 0;
876 }
877 // Warn if iterators do not point to same block_ulong
878 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
879 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
881 return 0;
882 }
883 return reverse ? i.position - this->position : this->position - i.position;
884 }
888 const_iterator_t() : iterator_base<block_ulong,unsigned long,reverse>(){}
896 }
902 bool operator==( iterator_t<reverse> const& i ) const {
903 return this->v == i.v and this->position == i.position;
904 }
910 bool operator!=( iterator_t<reverse> const& i ) const {
911 return not this->operator==( i );
912 }
918 bool operator<( iterator_t<reverse> const& i ) const {
919 // Warn if either iterator undefined
920 if( this->v == 0 or i.v == 0 ){
921 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
922 return false;
923 }
924 // Warn if iterators do not point to same block_ulong
925 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
926 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
928 return false;
929 }
930 return reverse ? i.position < this->position : this->position < i.position;
931 }
937 bool operator==( const_iterator_t<reverse> const& i ) const {
938 return this->v == i.v and this->position == i.position;
939 }
945 bool operator!=( const_iterator_t<reverse> const& i ) const {
946 return not this->operator==( i );
947 }
953 bool operator<( const_iterator_t<reverse> const& i ) const {
954 // Warn if either iterator undefined
955 if( this->v == 0 or i.v == 0 ){
956 gsl_error( "iterator not initialised", __FILE__, __LINE__, exception::GSL_EFAILED );
957 return false;
958 }
959 // Warn if iterators do not point to same block_ulong
960 if( this->v->ccgsl_pointer != i.v->ccgsl_pointer ){
961 gsl_error( "trying to take difference of iterators for different block_ulongs", __FILE__, __LINE__,
963 return false;
964 }
965 return reverse ? i.position < this->position : this->position < i.position;
966 }
967 protected:
968 // We need a constructor for block_ulong
969 friend class block_ulong;
976 : iterator_base<block_ulong const,unsigned long,reverse>( v, position ){}
977 };
978 public:
995 // type difference_type
1000 // type size_type
1004 typedef size_t size_type;
1005 // begin()
1011 return iterator( this, 0 );
1012 }
1018 return const_iterator( this, 0 );
1019 }
1020 // end()
1026 if( ccgsl_pointer == 0 ) return iterator( this, 0 );
1027 return iterator( this, size() );
1028 }
1034 if( ccgsl_pointer == 0 ) return const_iterator( this, 0 );
1035 return const_iterator( this, size() );
1036 }
1037 // size()
1042 size_type size() const { return ccgsl_pointer->size; }
1048 unsigned long* data() {
1049 if( ccgsl_pointer == 0 ) gsl_error( "null block_ulong", __FILE__, __LINE__, GSL_EFAULT );
1050 return ccgsl_pointer->data; }
1056 unsigned long const* data() const {
1057 if( ccgsl_pointer == 0 ) gsl_error( "null block_ulong", __FILE__, __LINE__, GSL_EFAULT );
1058 return ccgsl_pointer->data; }
1059 // max_size()
1065 size_type max_size() const { return ccgsl_pointer->size; }
1066 // empty()
1071 bool empty() const { return ccgsl_pointer == 0 or ccgsl_pointer->size == 0; }
1072 // swap() --- should work even if sizes don't match
1078 void swap( block_ulong& v ){
1079 std::swap( ccgsl_pointer, v.ccgsl_pointer );
1080 std::swap( count, v.count );
1081 }
1082 // Refines reversible container
1083 // rbegin()
1089 if( ccgsl_pointer ==0 ) return reverse_iterator( this, 0 );
1090 return reverse_iterator( this, size() - 1 );
1091 }
1097 if( ccgsl_pointer ==0 ) return const_reverse_iterator( this, 0 );
1098 return const_reverse_iterator( this, size() - 1 );
1099 }
1100 // rend()
1106 return reverse_iterator( this, -1 );
1107 }
1113 return const_reverse_iterator( this, -1 );
1114 }
1115 // operator[]
1121 unsigned long& operator[]( size_t const n ){
1122 // Always try to return something
1123 static unsigned long something = 0;
1124 // First check that iterator is initialised.
1125 if( ccgsl_pointer == 0 ){
1126 gsl_error( "block_ulong is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1127 return something;
1128 }
1129#ifndef GSL_RANGE_CHECK_OFF
1130 // Check that position make sense
1131 if( n >= size() ){
1132 gsl_error( "trying to read beyond end of block_ulong", __FILE__, __LINE__, exception::GSL_EINVAL );
1133 return something;
1134 }
1135 // n is a valid position
1136#endif
1137 return *(ccgsl_pointer->data + n);
1138 }
1144 unsigned long const& operator[]( size_t const n ) const {
1145 // Always try to return something
1146 static unsigned long something = 0;
1147 // First check that iterator is initialised.
1148 if( ccgsl_pointer == 0 ){
1149 gsl_error( "block_ulong is null", __FILE__, __LINE__, exception::GSL_EFAULT );
1150 return something;
1151 }
1152#ifndef GSL_RANGE_CHECK_OFF
1153 // Check that position make sense
1154 if( n >= size() ){
1155 gsl_error( "trying to read beyond end of block_ulong", __FILE__, __LINE__, exception::GSL_EINVAL );
1156 return something;
1157 }
1158 // n is a valid position
1159#endif
1160 return *(ccgsl_pointer->data + n);
1161 }
1162 private:
1166 gsl_block_ulong* ccgsl_pointer;
1170 size_t* count;
1171 public:
1172 // shared reference functions
1177 gsl_block_ulong* get() const { return ccgsl_pointer; }
1183 bool unique() const { return count != 0 and *count == 1; }
1188 size_t use_count() const { return count == 0 ? 0 : *count; }
1194#ifdef __GXX_EXPERIMENTAL_CXX0X__
1195 explicit
1196#endif
1197 operator bool() const { return ccgsl_pointer != 0; }
1198 };
1199
1200 // gsl functions
1201
1208 inline block_ulong::iterator operator+
1210 block_ulong::iterator const& i ){
1211 return i + n;
1212 }
1213
1222 block_ulong::const_iterator const& i ){
1223 return i + n;
1224 }
1225
1235 return i + n;
1236 }
1237
1247 return i + n;
1248 }
1249
1250}
1251
1252#endif
A class template for the const iterators.
const_iterator_t< reverse > & operator--()
The prefix – operator.
bool operator==(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
difference_type operator-(iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
const_iterator_t< reverse > operator++(int)
The postfix ++ operator.
const_iterator_t< reverse > operator+(difference_type const n) const
The + operator.
const_iterator_t< reverse > & operator++()
The prefix ++ operator.
const_iterator_t(block_ulong const *v, difference_type position)
This constructor allows block_ulong to create non-default iterators.
bool operator==(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
bool operator!=(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
bool operator!=(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
bool operator<(iterator_t< reverse > const &i) const
Comparison with non-const iterator.
const_iterator_t< reverse > operator--(int)
The postfix – operator.
const_iterator_t(iterator_t< reverse > const &i)
A copy constructor.
difference_type operator-(const_iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
const_iterator_t< reverse > & operator+=(difference_type const n)
The += operator.
bool operator<(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
const_iterator_t< reverse > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
const_iterator_t< reverse > & operator-=(difference_type const n)
The -= operator.
const_iterator_t()
The default constructor.
iterator_base< block_ulongconst, unsignedlong, reverse >::difference_type difference_type
Difference type.
const_iterator_t< reverse > & operator=(const_iterator_t< reverse > const &i)
We can assign one output iterator from another.
The container must have iterator types.
void decrement()
Decrement the iterator.
bool operator!=(iterator_base< container, content, reverse > const &i) const
The != operator.
value_type & reference
An iterator must have a reference type.
iterator_base()
The iterator is default constructible.
iterator_base(container *v, difference_type position)
This constructor allows block_ulong to create non-default iterators.
pointer operator->() const
Dereference the pointer.
difference_type position
Mark position of iterator within block_ulong.
void shift(difference_type const n)
Shift iterator n places.
value_type * pointer
An iterator must have a pointer typea.
difference_type operator-(iterator_base< container, content, reverse > const &i) const
The - operator: find distance between two iterators.
bool operator==(iterator_base< container, content, reverse > const &i) const
The == operator.
reference operator[](difference_type const n) const
Get element at i + n by reference ([] operator).
void increment()
Increment the iterator.
container * v
Store a pointer to a block_ulong we can iterate over: 0 if no block_ulong.
unsigned long value_type
An iterator must have a value type.
reference operator*() const
Dereference the pointer.
bool operator<(iterator_base< container, content, reverse > const &i) const
The < operator is used to compare iterators.
std::random_access_iterator_tag iterator_category
An iterator must have an iterator category.
ptrdiff_t difference_type
An iterator must have a difference_type.
A class template for the two non-const iterators.
difference_type operator-(iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
iterator_base< block_ulong, unsignedlong, reverse >::difference_type difference_type
Difference type.
iterator_t()
The default constructor.
iterator_t< reverse > & operator+=(difference_type const n)
The += operator.
iterator_t< reverse > operator+(difference_type const n) const
The + operator.
iterator_t< reverse > & operator--()
The prefix – operator.
bool operator<(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
iterator_t< reverse > & operator++()
The prefix ++ operator.
difference_type operator-(const_iterator_t< reverse > const &i) const
The - operator: find distance between two iterators.
iterator_t< reverse > operator--(int)
The postfix – operator.
iterator_t< reverse > & operator=(iterator_t< reverse > const &i)
We can assign one output iterator from another.
iterator_t< reverse > & operator-=(difference_type const n)
The -= operator.
iterator_t(block_ulong *v, difference_type position)
This constructor allows block_ulong to create non-default iterators.
bool operator==(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
bool operator!=(const_iterator_t< reverse > const &i) const
Comparison with const iterator.
iterator_t< reverse > operator++(int)
The postfix ++ operator.
iterator_t< reverse > operator-(difference_type const n) const
The - operator: subtract distance from iterator.
This class handles vector_ulongs as shared handles.
Definition: block_ulong.hpp:41
const_iterator begin() const
Get iterator pointing to first block_ulong element.
bool operator<=(block_ulong const &v) const
A container needs to define an ordering for sorting.
const_reverse_iterator rend() const
Get iterator pointing beyond last block_ulong element.
block_ulong(block_ulong const &v)
The copy constructor.
value_type const & const_reference
A container must have a constant reference type.
const_iterator_t< false > const_iterator
The const_iterator type.
block_ulong & operator=(block_ulong &&v)
Move operator.
iterator_t< true > reverse_iterator
The reverse_iterator type.
value_type & reference
A container must have a reference type.
size_t size_type
A container must have a size_type.
unsigned long value_type
A container must have a value_type.
gsl_block_ulong * get() const
Get the gsl_block_ulong.
size_type max_size() const
The max size (number of elements) of the block_ulong.
gsl_block_ulong * ccgsl_pointer
The shared pointer.
const_iterator_t< true > const_reverse_iterator
The const_reverse_iterator type.
unsigned long const * data() const
Give access to the data block_ulong.
bool operator<(block_ulong const &v) const
A container needs to define an ordering for sorting.
block_ulong(block_ulong &&v)
Move constructor.
bool operator>=(block_ulong const &v) const
A container needs to define an ordering for sorting.
bool unique() const
Find if this is the only object sharing the gsl_block_ulong.
const_reverse_iterator rbegin() const
Get iterator pointing to first block_ulong element.
const_iterator end() const
Get iterator pointing beyond last block_ulong element.
value_type * pointer
A container must have a pointer type.
block_ulong & operator=(block_ulong const &v)
The assignment operator.
reverse_iterator rbegin()
Get iterator pointing to first block_ulong element.
~block_ulong()
The destructor only deletes the pointers if count reaches zero.
block_ulong(gsl_block_ulong *v)
Could construct from a gsl_block_ulong.
Definition: block_ulong.hpp:78
bool operator>(block_ulong const &v) const
A container needs to define an ordering for sorting.
block_ulong()
The default constructor is only really useful for assigning to.
Definition: block_ulong.hpp:46
size_t use_count() const
Find how many block_ulong objects share this pointer.
value_type const * const_pointer
A container must have a constant pointer type.
bool operator!=(block_ulong const &v) const
Two block_ulong objects are different equal if their elements are not identical.
block_ulong(size_t const n)
The default constructor creates a new block_ulong with n elements.
Definition: block_ulong.hpp:56
void reset()
Stop sharing ownership of the shared pointer.
iterator begin()
Get iterator pointing to first block_ulong element.
unsigned long * data()
Give access to the data block_ulong.
const_iterator::difference_type difference_type
A container must have a difference_type.
bool operator==(block_ulong const &v) const
Two block_ulong objects are identically equal if their elements are identical.
void swap(block_ulong &v)
Swap two block_ulong objects.
reverse_iterator rend()
Get iterator pointing beyond last block_ulong element.
block_ulong(std::initializer_list< unsigned long > initializer_list)
Could construct from a std::initializer_list in C++11.
Definition: block_ulong.hpp:89
iterator end()
Get iterator pointing beyond last block_ulong element.
unsigned long & operator[](size_t const n)
Get element at position n by reference ([] operator).
size_type size() const
The size (number of elements) of the block_ulong.
block_ulong clone() const
The clone function.
bool empty() const
Find if the block_ulong is empty.
size_t * count
The shared reference count.
iterator_t< false > iterator
The iterator type.
unsigned long const & operator[](size_t const n) const
Get element at position n by reference ([] operator).
@ GSL_EFAILED
generic failure
Definition: exception.hpp:476
@ GSL_EINVAL
invalid argument supplied by user
Definition: exception.hpp:475
@ GSL_EFAULT
invalid pointer
Definition: exception.hpp:474
int min(movstat::end_t const endtype, vector const &x, vector &y, workspace &w)
C++ version of gsl_movstat_min().
Definition: movstat.hpp:581
size_t n(workspace const &w)
C++ version of gsl_rstat_n().
Definition: rstat.hpp:299
gsl_sf_result result
Typedef for gsl_sf_result.
Definition: sf_result.hpp:30
The gsl package creates an interface to the GNU Scientific Library for C++.
Definition: blas.hpp:34