> On Feb. 19, 2014, 8:52 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp, line 159
> > <https://reviews.apache.org/r/17520/diff/2/?file=469354#file469354line159>
> >
> > I definitely prefer the SFINAE approach to the last one! Can we make
> > this a default template parameter instead though? This has been the
> > convention with SFINAE in libprocess (although there is a rather small
> > footprint of SFINAE), and we've used function parameters to further
> > disambiguate beyonod SFINAE (see Prefer/LessPrefer future.hpp in
> > libprocess).
Ben - I tried to do that and I got a compiler error "error: default template
arguments may not be used in function templates". I'm using :
[tw-mbp13-ccarson.local Wed Feb 19 01:40:29 (fixJSONbool) ~/mesos/build]$>g++
--version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658)
(LLVM build 2336.11.00)
am I using the wrong version of C++ or should I wrap it in #if {C++11} ?
- Charlie
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/17520/#review34924
-----------------------------------------------------------
On Feb. 4, 2014, 9:41 p.m., Charlie Carson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17520/
> -----------------------------------------------------------
>
> (Updated Feb. 4, 2014, 9:41 p.m.)
>
>
> Review request for mesos, Benjamin Hindman and Jeff Currier.
>
>
> Bugs: https://issues.apache.org/jira/browse/MESOS-939
>
> https://issues.apache.org/jira/browse/https://issues.apache.org/jira/browse/MESOS-939
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Add JSON::Boolean to stout/json.hpp.
>
> If you assign an JSON::Object a bool then it will get coerced into
> a JSON::Number w/ value of 0.0 or 1.0. This is because JSON::True
> and JSON::False do not have constructors from bool.
>
> The fix is to introduce a common super class, JSON::Boolean, which
> both JSON::True and JSON::False inherit from. JSON::Boolean has the
> necessary constructor which takes a bool.
>
> However, this leads to ambiguity when assigning a cstring to
> a JSON::Value, since JSON::String already takes a const char * and
> a const char * is implicitly convertable to a bool.
>
> The solution for that is to rename the variant from JSON::Value
> to JSON::inner::Variant and to create a new class JSON::Value
> which inherits from JSON::inner::Variant. The new JSON::Value
> can have all the conversion constructors in a single place, so
> is no ambiguity, and delegate everythign else to the Variant.
>
> Also added a bunch of unit tests.
>
> SEE: https://issues.apache.org/jira/browse/MESOS-939
>
> Review: https://reviews.apache.org/r/17520
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
> 3148a7873397f6b0b2ebdbff3b640535ccd12318
> 3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
> 29ada8a4a0396f889eb2583c3b3ff622050125af
>
> Diff: https://reviews.apache.org/r/17520/diff/
>
>
> Testing
> -------
>
> make check + new unit tests
>
>
> Thanks,
>
> Charlie Carson
>
>