[ 
https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972558#comment-15972558
 ] 

James E. King, III commented on THRIFT-2221:
--------------------------------------------

I think it would be better to use something like this as a new header similar 
to cxxfunctional:
{noformat}
#pragma once

#include <boost/config.hpp>

#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
#include <boost/shared_ptr.hpp>
#else
#include <memory>
#endif

namespace apache
{
        namespace thrift
        {
                namespace cxx
                {
#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
                        using ::boost::shared_ptr;
#else
                        using ::std::shared_ptr;
#endif
                }
        }
}
{noformat}

Then in implementations one would change boost::shared_ptr to cxx::shared_ptr, 
which would be an alias to the correct type.  Note that the library still 
requires other boost components.  It also allows the user to force use of boost 
smart pointer for backwards compatibility.

> 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)

Reply via email to