DeSiGNAR  0.5a
Data Structures General Library
types.H
Go to the documentation of this file.
1 /*
2  This file is part of Designar.
3  Copyright (C) 2017 by Alejandro J. Mujica
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 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU 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, see <http://www.gnu.org/licenses/>.
17 
18  Any user request of this software, write to
19 
20  Alejandro Mujica
21 
22  aledrums@gmail.com
23 */
24 
25 # ifndef DSGTYPES_H
26 # define DSGTYPES_H
27 
28 # include <cmath>
29 # include <cstring>
30 # include <cassert>
31 # include <iostream>
32 # include <string>
33 # include <sstream>
34 # include <fstream>
35 # include <tuple>
36 # include <stdexcept>
37 # include <limits>
38 # include <chrono>
39 # include <random>
40 # include <functional>
41 # include <thread>
42 # include <mutex>
43 # include <condition_variable>
44 
45 # include <typetraits.H>
46 
47 namespace Designar
48 {
49  using lint_t = long long;
50  using nat_t = unsigned long int;
51  using real_t = double;
52  using rng_t = std::mt19937_64;
53  using rng_seed_t = rng_t::result_type;
54  using clock_t = std::chrono::high_resolution_clock;
55  using time_point_t = clock_t::time_point;
56  using duration_t = clock_t::duration;
57 
58  constexpr lint_t QuicksortThreshold = 40;
59 
60  class EmptyClass
61  {
62  public:
63  EmptyClass() { /* empty */ }
64 
65  EmptyClass(const EmptyClass &) { /* empty */ }
66 
67  EmptyClass(EmptyClass &&) { /* empty */ }
68 
69  ~EmptyClass() { /* empty */ }
70 
71  EmptyClass & operator = (const EmptyClass &) { return *this; }
72 
73  EmptyClass & operator = (EmptyClass &&) { return *this; }
74 
75  bool operator == (const EmptyClass &) const { return true; }
76 
77  bool operator != (const EmptyClass &) const { return false; }
78 
79  bool operator < (const EmptyClass &) const { return false; }
80 
81  bool operator <= (const EmptyClass &) const { return true; }
82 
83  bool operator > (const EmptyClass &) const { return false; }
84 
85  bool operator >= (const EmptyClass &) const { return true; }
86 
87  friend std::ostream & operator << (std::ostream & out, const EmptyClass &)
88  {
89  return out;
90  }
91 
92  friend std::istream & operator >> (std::istream & in, EmptyClass &)
93  {
94  return in;
95  }
96  };
97 
98 } // end namespace Designar
99 
100 # endif // DSGTYPES_H
friend std::ostream & operator<<(std::ostream &out, const EmptyClass &)
Definition: types.H:87
constexpr lint_t QuicksortThreshold
Definition: types.H:58
EmptyClass(const EmptyClass &)
Definition: types.H:65
EmptyClass()
Definition: types.H:63
clock_t::duration duration_t
Definition: types.H:56
EmptyClass & operator=(const EmptyClass &)
Definition: types.H:71
bool operator!=(const EmptyClass &) const
Definition: types.H:77
std::chrono::high_resolution_clock clock_t
Definition: types.H:54
double real_t
Definition: types.H:51
bool operator<(const EmptyClass &) const
Definition: types.H:79
~EmptyClass()
Definition: types.H:69
std::mt19937_64 rng_t
Definition: types.H:52
bool operator>(const EmptyClass &) const
Definition: types.H:83
rng_t::result_type rng_seed_t
Definition: types.H:53
long long lint_t
Definition: types.H:49
bool operator>=(const EmptyClass &) const
Definition: types.H:85
bool operator<=(const EmptyClass &) const
Definition: types.H:81
clock_t::time_point time_point_t
Definition: types.H:55
Definition: array.H:32
unsigned long int nat_t
Definition: types.H:50
Definition: types.H:60
bool operator==(const EmptyClass &) const
Definition: types.H:75
EmptyClass(EmptyClass &&)
Definition: types.H:67
friend std::istream & operator>>(std::istream &in, EmptyClass &)
Definition: types.H:92