https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Bool.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "DataIO.h"
13
18struct Bool
19{
20 // If an 'uninitialized' Bool is created, set _value to false
21 Bool() : _value(false) {}
22 Bool(bool b) : _value(b) {}
23
24 // This allows a lot of stuff that works for bool to also work for
25 // Bool, like cout.
26 operator bool &() { return _value; }
27 operator const bool &() const { return _value; }
28
29 Bool & operator=(const bool & other)
30 {
31 _value = other;
32 return *this;
33 }
34
35 bool _value;
36};
37
38template <>
39void dataStore(std::ostream & stream, Bool & v, void * context);
40
41template <>
42void dataLoad(std::istream & stream, Bool & v, void * context);
void dataLoad(std::istream &stream, Bool &v, void *context)
Definition Bool.C:21
void dataStore(std::ostream &stream, Bool &v, void *context)
Definition Bool.C:14
const double v
A wrapper for the C++ boolean type which can be stored in vectors in the same way as other C++ types.
Definition Bool.h:19
Bool()
Definition Bool.h:21
Bool(bool b)
Definition Bool.h:22
bool _value
Definition Bool.h:35
Bool & operator=(const bool &other)
Definition Bool.h:29