hmbdc
simplify-high-performance-messaging-programming
Main Page
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Friends
Pages
hmbdc
Typed.hpp
1
#include "hmbdc/Copyright.hpp"
2
#pragma once
3
#include <iostream>
4
5
namespace
hmbdc {
6
template
<
char
const NAME[],
typename
T>
7
struct
Typed
{
8
Typed
(){}
9
explicit
Typed
(T v)
10
: v_(v){}
11
12
explicit
operator
T() {
13
return
v_;
14
}
15
16
bool
operator < (
Typed
t)
const
{
return
v_ < t.v_;}
17
bool
operator > (
Typed
t)
const
{
return
v_ > t.v_;}
18
bool
operator <= (
Typed
t)
const
{
return
v_ <= t.v_;}
19
bool
operator >= (
Typed
t)
const
{
return
v_ >= t.v_;}
20
bool
operator == (
Typed
t)
const
{
return
v_ == t.v_;}
21
22
Typed
operator+(
Typed
t)
const
{
return
Typed
(v_ + t.v_);}
23
Typed
operator-(
Typed
t)
const
{
return
Typed
(v_ - t.v_);}
24
Typed
operator*(
Typed
t)
const
{
return
Typed
(v_ * t.v_);}
25
Typed
operator/(
Typed
t)
const
{
return
Typed
(v_ / t.v_);}
26
27
Typed
& operator+=(
Typed
t) {v_ += t.v_;
return
*
this
;}
28
Typed
& operator-=(
Typed
t) {v_ -= t.v_;
return
*
this
;}
29
Typed
& operator*=(
Typed
t) {v_ *= t.v_;
return
*
this
;}
30
Typed
& operator/=(
Typed
t) {v_ /= t.v_;
return
*
this
;}
31
32
friend
33
std::ostream& operator << (std::ostream& os,
Typed
const
& t) {
34
return
os << t.v_;
35
}
36
friend
37
std::istream& operator >> (std::istream& is,
Typed
& t) {
38
return
is >> t.v_;
39
}
40
private
:
41
T v_;
42
};
43
}
44
45
hmbdc::Typed
Definition:
Typed.hpp:7
Generated by
1.8.5