[
https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972322#comment-15972322
]
Mario Emmenlauer commented on THRIFT-2221:
------------------------------------------
Maybe its possible to have both options available with the help of defines?
I.e. one could use a dedicated header with something like
{code}
#if USE_BOOST_SHARED_PTR
#include <boost/shared_ptr.hpp>
#define shared_ptr_namespace boost
#else
#include <memory>
#define shared_ptr_namespace std
#endif
{code}
And in the code change:
{code}
-boost::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
+shared_ptr_namespace::shared_ptr<TSocket> socket(new TSocket("127.0.0.1",
port));
{code}
Admittedly, this does not read as fluent as the current code does, but I think
it would
encapsulate the boost namespace quite nicely, and allow users to switch.
Personally
I use std::shared_ptr everywhere in my code, and nowadays many users have a
c++11
compiler?
> Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
> --------------------------------------------------------------------
>
> Key: THRIFT-2221
> URL: https://issues.apache.org/jira/browse/THRIFT-2221
> Project: Thrift
> Issue Type: Task
> Components: C++ - Compiler
> Affects Versions: 0.9.1
> Environment: C++11 compilers with std::shared_ptr support
> Reporter: Chris Stylianou
> Priority: Minor
> Labels: c++11, compiler, thrift
>
> Most modern compilers now have full support for std::shared_ptr when enable
> with c++11 flags. It would be nice to have the option to generate code that
> uses this instead of boost::shared_ptr. This would enable us to remove
> another boost dependency, on the road to a dependency-free thrift library :)
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)