Browse Source

Add support for if (String) syntax

main
PaulStoffregen 7 years ago
parent
commit
253da1599d
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      teensy3/WString.h

+ 7
- 0
teensy3/WString.h View File

@@ -196,6 +196,13 @@ protected:
void init(void);
unsigned char changeBuffer(unsigned int maxStrLen);
String & append(const char *cstr, unsigned int length);
private:
// allow for "if (s)" without the complications of an operator bool().
// for more information http://www.artima.com/cppsource/safebool.html
typedef void (String::*StringIfHelperType)() const;
void StringIfHelper() const {}
public:
operator StringIfHelperType() const { return buffer ? &String::StringIfHelper : 0; }
};

class StringSumHelper : public String

Loading…
Cancel
Save