summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-28 18:44:08 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-28 18:44:08 (GMT)
commite0e37477974e914cab60d9978bae5811d865cd62 (patch)
tree3d8b13fdd8469a06b98316c3ea05fbe6ee75e6be
parent2b211eb8bac6ec65652b1bf4bbbcc196d28773ba (diff)
downloadCastXML-e0e37477974e914cab60d9978bae5811d865cd62.zip
CastXML-e0e37477974e914cab60d9978bae5811d865cd62.tar.gz
CastXML-e0e37477974e914cab60d9978bae5811d865cd62.tar.bz2
Output: Fix compilation with VS 2012
VS 2012 does not support 'explicit' conversion operators or initialization of fields at their declaration.
-rw-r--r--src/Output.cxx28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index 424d523..a5639e5 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -51,11 +51,17 @@ protected:
// Represent cv qualifier state of one dump node.
struct DumpQual {
- bool IsConst = false;
- bool IsVolatile = false;
- bool IsRestrict = false;
- explicit operator bool() const {
- return this->IsConst || this->IsVolatile || this->IsRestrict;
+ private:
+ typedef void (DumpQual::*bool_type)() const;
+ void bool_true() const {}
+ public:
+ bool IsConst;
+ bool IsVolatile;
+ bool IsRestrict;
+ DumpQual(): IsConst(false), IsVolatile(false), IsRestrict(false) {}
+ operator bool_type() const {
+ return (this->IsConst || this->IsVolatile || this->IsRestrict)?
+ &DumpQual::bool_true : nullptr;
}
friend bool operator < (DumpQual const& l, DumpQual const& r) {
if (!l.IsConst && r.IsConst) {
@@ -84,12 +90,16 @@ protected:
// Represent id of one dump node.
struct DumpId {
- unsigned int Id = 0;
+ private:
+ typedef void (DumpId::*bool_type)() const;
+ void bool_true() const {}
+ public:
+ unsigned int Id;
DumpQual Qual;
- DumpId() {}
+ DumpId(): Id(0), Qual() {}
DumpId(unsigned int id, DumpQual dq): Id(id), Qual(dq) {}
- explicit operator bool() const {
- return this->Id != 0;
+ operator bool_type() const {
+ return this->Id != 0? &DumpId::bool_true : nullptr;
}
friend bool operator < (DumpId const& l, DumpId const& r) {
if (l.Id < r.Id) {