SDPSL
Semidefinite Programming Specification Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Friends
Pages
sref.h
Go to the documentation of this file.
1
7
#ifndef __SREF_H__
8
#define __SREF_H__
9
10
#ifdef __MPF_BUILD__
11
namespace
mpf_sdp {
12
#else
13
namespace
sdp {
14
#endif
15
26
template
<
class
T>
27
class
shared_ref
{
28
T obj;
29
30
public
:
32
shared_ref
(
const
shared_ref
& other) : obj(other.obj, other.obj.take_data()) { }
33
35
explicit
shared_ref
(T& ins) : obj(ins, ins.take_data()) { }
36
38
T *
ptr
() {
return
&obj; }
39
41
T *
operator->
() {
return
&obj; }
42
44
T&
operator*
() {
return
obj; }
45
47
shared_ref
& operator=(
const
shared_ref
&) =
delete
;
48
};
49
58
template
<
class
T>
59
class
const_shared_ref
{
60
T obj;
61
62
public
:
64
const_shared_ref
(
const
const_shared_ref
& other) : obj(other.obj, other.obj.take_data()) { }
65
67
explicit
const_shared_ref
(
const
T& ins) : obj(ins, ins.take_data()) { }
68
70
const
T *
ptr
()
const
{
return
&obj; }
71
73
const
T *
operator->
()
const
{
return
&obj; }
74
76
const
T&
operator*
()
const
{
return
obj; }
77
79
const_shared_ref
& operator=(
const
const_shared_ref
&) =
delete
;
80
};
81
82
}
// namespace
83
84
#endif
85
86
// Local variables:
87
// mode: c++
88
// End:
include
sdpsl
sref.h
Generated on Fri Feb 7 2014 09:32:26 for SDPSL by
1.8.4