PolyBoRi
CCheckedIdx.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_common_CCheckedIdx_h_
17 #define polybori_common_CCheckedIdx_h_
18 
19 // include basic definitions
20 #include <polybori/pbori_defs.h>
21 
23 
30  public CTypes::auxtypes_type {
31 
33  typedef CCheckedIdx self;
34 
35 public:
36  CCheckedIdx(idx_type idx): m_idx(idx) {
37  if PBORI_UNLIKELY(idx < 0) handle_error();
38  }
39  CCheckedIdx(const self& rhs): m_idx(rhs.m_idx) { }
41 
42  operator idx_type() const { return m_idx; }
43 private:
44  void handle_error() const;
45  idx_type m_idx;
46 };
47 
49 
50 #endif
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
CCheckedIdx(idx_type idx)
Definition: CCheckedIdx.h:36
~CCheckedIdx()
Definition: CCheckedIdx.h:40
int idx_type
Type for indices.
Definition: pbori_defs.h:228
CCheckedIdx(const self &rhs)
Definition: CCheckedIdx.h:39
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
This class defines CCheckedIdx.
Definition: CCheckedIdx.h:29