SigUtil
0.95
Utility modules for modern C++
|
パーセント型 More...
Public Member Functions | |
Percent (int percent) | |
int | get_percent () const |
double | get_double () const |
Percent | operator= (Percent src) |
Percent | operator= (int src) |
bool | operator== (Percent obj) const |
bool | operator!= (Percent obj) const |
Static Public Member Functions | |
static Percent const & | unit () |
Friends | |
class | boost::serialization::access |
template<class Archive > | |
void | save_construct_data (Archive &ar, Percent const *p, unsigned int version) |
template<class Archive > | |
void | load_construct_data (Archive &ar, Percent *p, unsigned int version) |
パーセント型
Percent pc1(100); Percent pc2(50); Percent pc3(0); Percent pc4(0);
pc3 = 1; // copy assignment. pc4 == 1% pc4 = Percent::unit(); // copy assignment. pc3 == 100%
assert(pc1.get_percent() == 100 && equal(pc1.get_double(), 1)); // 100% = 1 assert(pc2.get_percent() == 50 && equal(pc2.get_double(), 0.5)); // 50% = 0.5 assert(pc3.get_percent() == 1 && equal(pc3.get_double(), 0.01)); // 1% = 0.01 assert(pc1 == pc4);
Definition at line 36 of file percent.hpp.
|
inlineexplicit |
Definition at line 41 of file percent.hpp.
|
inline |
Definition at line 44 of file percent.hpp.
|
inline |
Definition at line 43 of file percent.hpp.
|
inline |
Definition at line 53 of file percent.hpp.
Definition at line 48 of file percent.hpp.
|
inline |
Definition at line 49 of file percent.hpp.
|
inline |
Definition at line 51 of file percent.hpp.
|
inlinestatic |
Definition at line 46 of file percent.hpp.
|
friend |
Definition at line 57 of file percent.hpp.
|
friend |
Definition at line 69 of file percent.hpp.
|
friend |
Definition at line 66 of file percent.hpp.