I do not know of what compatibility goals this library has except that travis ci is set up for clang 3.3 and gcc 4.8. I also do not know that this is the most opportune time to upgrade, but I thought I'd make this "issue" to discuss some of the pros, cons, and steps to adopting the C++1y features in these two releases.
One example of a c++1y feature I required: I went through ftl/include/memory.h and added a specialization for std::unique_ptr for everything std::shared_ptr had a specialization. I discovered that the definition of deriving_map<in_terms_of_bind<M>> didn't work because unique_ptrs are move-only. gcc 4.8 can do this, but it requires 3.4 of clang.
See: splinterofchaos/ftl@5934a44
To summarize the language features allowed by both gcc 4.9 and clang 3.4 that I think might benefit ftl:
| Feature |
Usage |
| Generalized lambda init-capture |
(See above) |
| Polymorphic lambdas |
Not sure if this is useful to ftl because they cannot properly forward, but they can certainly apply value semantics properly. |
| auto/decltype(auto) for declarations and functions. |
Simplify some of the code, removing long, messy typedefs to determine a return type. |
| Use of [[depricated]]. |
Just in case. |
And the library additions:
| Feature |
Usage |
std::integer_sequence |
Simplify some of the tuple.h code. Standard solution to ftl::seq, but with a few more bells and whistles. |
std::experimental::optional |
Basically, std::maybe. (Not sure if gcc 4.9 has this.) |
operator() overload for std::integral_constant. |
std::is_same<T,U>() vs. std::is_same<T,U>::value. |
SFINAE std::result_of |
(Self explanatory.) |
gcc has yet to implement variable templates, relaxed constexprs, or TypeTraitsRedux, to name a few.
Only upgrading to clang 3.4 would enable auto for function return types, which gcc 4.8 implements, although gcc 4.8 may not work for every situation clang does because it's based on an out-of-date proposal.
clang 3.4 would allow experiments with variable templates, but break gcc compatibility.
I did have to modify some of the code that I submitted in order to get clang 3.4 to compile my master: splinterofchaos/ftl@749805a
Since the new releases of clang and gcc might not be readily available to everyone, it might be best to maintain backwards compatibility. In that case, both compilers define the macro __cplusplus as 201103 when in c++11 mode, and a higher number for c++1y (though clang and gcc use 201305 and 201300, respectively, for c++1y mode). Furthermore, since clang uses a slightly higher number, and has slightly more features, this macro can be used to distinguish between what gcc and clang can handle.
I do not know of what compatibility goals this library has except that travis ci is set up for clang 3.3 and gcc 4.8. I also do not know that this is the most opportune time to upgrade, but I thought I'd make this "issue" to discuss some of the pros, cons, and steps to adopting the C++1y features in these two releases.
One example of a c++1y feature I required: I went through ftl/include/memory.h and added a specialization for
std::unique_ptrfor everythingstd::shared_ptrhad a specialization. I discovered that the definition ofderiving_map<in_terms_of_bind<M>>didn't work becauseunique_ptrs are move-only. gcc 4.8 can do this, but it requires 3.4 of clang.See: splinterofchaos/ftl@5934a44
To summarize the language features allowed by both gcc 4.9 and clang 3.4 that I think might benefit ftl:
And the library additions:
std::integer_sequenceftl::seq, but with a few more bells and whistles.std::experimental::optionalstd::maybe. (Not sure if gcc 4.9 has this.)operator()overload forstd::integral_constant.std::is_same<T,U>()vs.std::is_same<T,U>::value.std::result_ofgcc has yet to implement variable templates, relaxed constexprs, or TypeTraitsRedux, to name a few.
Only upgrading to clang 3.4 would enable auto for function return types, which gcc 4.8 implements, although gcc 4.8 may not work for every situation clang does because it's based on an out-of-date proposal.
clang 3.4 would allow experiments with variable templates, but break gcc compatibility.
I did have to modify some of the code that I submitted in order to get clang 3.4 to compile my master: splinterofchaos/ftl@749805a
Since the new releases of clang and gcc might not be readily available to everyone, it might be best to maintain backwards compatibility. In that case, both compilers define the macro
__cplusplusas201103when inc++11mode, and a higher number forc++1y(though clang and gcc use201305and201300, respectively, forc++1ymode). Furthermore, since clang uses a slightly higher number, and has slightly more features, this macro can be used to distinguish between what gcc and clang can handle.