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

ASF GitHub Bot commented on THRIFT-2221:
----------------------------------------

Github user octopus-prime commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131985807
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    --- End diff --
    
    What is this test/include for? BOOST_NO_CXX11_SMART_PTR told us above that 
c++11 smart pointers are available.


> 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: Improvement
>          Components: C++ - Compiler
>    Affects Versions: 0.9.1
>         Environment: C++11 compilers with std::shared_ptr support
>            Reporter: Chris Stylianou
>            Assignee: James E. King, III
>              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.4.14#64029)

Reply via email to