summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-06-24 18:30:58 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-06-25 13:49:20 -0700
commitc9c81a610d97c95c15f938ecd07ceb71cb0cdfb1 (patch)
tree7637cf53216c6d0b8deadbfb8ea56faf4ff5bc85 /src/common
parentdbbfda0e96037da4f208ff8f00d181a5294484ae (diff)
downloadtmwa-c9c81a610d97c95c15f938ecd07ceb71cb0cdfb1.tar.gz
tmwa-c9c81a610d97c95c15f938ecd07ceb71cb0cdfb1.tar.bz2
tmwa-c9c81a610d97c95c15f938ecd07ceb71cb0cdfb1.tar.xz
tmwa-c9c81a610d97c95c15f938ecd07ceb71cb0cdfb1.zip
Fix bugs
Diffstat (limited to 'src/common')
-rw-r--r--src/common/strings.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/strings.hpp b/src/common/strings.hpp
index 2d34d57..37d4ee7 100644
--- a/src/common/strings.hpp
+++ b/src/common/strings.hpp
@@ -163,8 +163,13 @@ namespace strings
/// TODO implement a special one, that guarantees refcounting.
class FString : public _crtp_string<FString>
{
- const std::string _hack;
+ /*const*/ std::string _hack;
public:
+#ifndef __clang__
+ __attribute__((warning("This should be removed in the next diff")))
+#endif
+ FString(std::string s) : _hack(std::move(s)) {}
+
FString() : _hack() {}
FString(const MString& s) : _hack(s.begin(), s.end()) {}
template<size_t n>
@@ -250,6 +255,7 @@ namespace strings
__attribute__((warning("This should be removed in the next diff")))
#endif
ZString(const std::string& s) : _b(&*s.begin()), _e(&*s.end()) {}
+
enum { really_construct_from_a_pointer };
ZString() { *this = ZString(""); }
// no MString
@@ -515,8 +521,11 @@ namespace strings
// cxxstdio helpers
// I think the conversion will happen automatically. TODO test this.
- //const char *convert_for_printf(const FString& fs) { return fs.c_str(); }
- //const char *convert_for_printf(const TString& ts) { return ts.c_str(); }
+ // Nope, it doesn't, since there's a template
+ inline
+ const char *convert_for_printf(const FString& fs) { return fs.c_str(); }
+ inline
+ const char *convert_for_printf(const TString& ts) { return ts.c_str(); }
inline
const char *convert_for_printf(const ZString& zs) { return zs.c_str(); }
} // namespace strings