C++QEDCore  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BooleanNegatedProxy.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
3 // -*- C++ -*-
4 #ifndef CPPQEDCORE_UTILS_BOOLEANNEGATEDPROXY_H_INCLUDED
5 #define CPPQEDCORE_UTILS_BOOLEANNEGATEDPROXY_H_INCLUDED
6 
7 #include "BooleanNegatedProxyFwd.h"
8 
9 #include <iosfwd>
10 
11 namespace cpputils {
12 
13 
16 {
17 public:
19  ) : v_(v) {}
20 
22  operator bool() const {return !v_;}
23 
24  BooleanNegatedProxy& operator=(const BooleanNegatedProxy& other) {v_=other.v_; return *this;}
25 
26  BooleanNegatedProxy& operator=(bool v) {v_=!v; return *this;}
27 
28 private:
29  bool &v_;
30 
31 };
32 
33 
34 // std::ostream& operator<<(std::ostream&, const BooleanNegatedProxy&);
35 
37 std::istream& operator>>(std::istream&, BooleanNegatedProxy&);
38 
39 
40 } // cpputils
41 
42 #endif // CPPQEDCORE_UTILS_BOOLEANNEGATEDPROXY_H_INCLUDED
Namespace comprising otherwise hard-to-classify generic utilities.
Definition: Algorithm.h:10
Bound to a boolean lvalue, it behaves like a boolean always with opposite value.