[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122089#comment-16122089 ] Mario Emmenlauer commented on THRIFT-2221: -- Thanks again [~jking] , super great work and its highly appreciated! I'm very much looking forward to this release! > 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, C++ - Library >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 > Fix For: 0.11.0 > > > 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 :) > Solution summary (so you don't need to wade through the comments): > A new header, , creates the namespace apache::thrift::stdcxx > and aliases the proper std:: or boost:: constructs depending on the > capabilities of the environment and whether any build flags are used to force > an override of this behavior. All code throughout the project now uses > stdcxx:: for all smart_ptr and functional (bind, function, placeholders, _1, > _2, ...) constructs. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121953#comment-16121953 ] James E. King, III commented on THRIFT-2221: Okay that one was fun... :) > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121952#comment-16121952 ] ASF GitHub Bot commented on THRIFT-2221: Github user asfgit closed the pull request at: https://github.com/apache/thrift/pull/1328 > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121937#comment-16121937 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1328 The lone build failure is a "D" language/test issue that appears sporadically. All other builds passed. As such, I am going to merge this in given it was already reviewed, and the follow-on changes were fairly trivial. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121665#comment-16121665 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1328 I added a TPipe test because I changed one line of code in TPipe to work around a build issue, and I didn't see a TTransportTest test for TPipe. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119994#comment-16119994 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on the issue: https://github.com/apache/thrift/pull/1328 ![image](https://user-images.githubusercontent.com/11771245/29127276-a0e3e7da-7cee-11e7-9149-0e2c6f143f91.png) Still pushing changes here. Microsoft didn't make things easy by leaving __cplusplus at an old value even in the latest compilers. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118943#comment-16118943 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r132017398 --- Diff: lib/cpp/README.md --- @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent. ## Dependencies -boost shared pointers -http://www.boost.org/libs/smart_ptr/smart_ptr.htm +If your C++ environment implements C++11 or later, boost will automatically use --- End diff -- Fixed. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118931#comment-16118931 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r132013793 --- 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 + +/// +// +// functional (function, bind) +// +/// + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include +#define _THRIFT_FUNCTIONAL_TR1_ 1 +#endif + +#if _MSC_VER == 1600 +#include +#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 + + 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 +#else +#include + #if __cplusplus < 201103L +#include + #endif +#endif + +namespace apache { namespace thrift { namespace stdcxx { + +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR) + + using ::boost::const_pointer_cast; + using ::boost::dynamic_pointer_cast; + using ::boost::enable_shared_from_this; + using ::boost::make_shared; + using ::boost::scoped_ptr; + using ::boost::shared_ptr; + using ::boost::static_pointer_cast; + using ::boost::weak_ptr; + +#else + + using ::std::const_pointer_cast; + using ::std::dynamic_pointer_cast; + using ::std::enable_shared_from_this; + using ::std::make_shared; + // yes, they renamed in in std:: for some reason... --- End diff -- I removed it in the last PR. > 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 > Compo
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118932#comment-16118932 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r132013921 --- 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 + +/// +// +// functional (function, bind) +// +/// + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include +#define _THRIFT_FUNCTIONAL_TR1_ 1 +#endif + +#if _MSC_VER == 1600 +#include +#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 + + 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 +#else +#include + #if __cplusplus < 201103L --- End diff -- Cleaned up in the last push. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118928#comment-16118928 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r132013676 --- Diff: lib/cpp/README.md --- @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent. ## Dependencies -boost shared pointers -http://www.boost.org/libs/smart_ptr/smart_ptr.htm +If your C++ environment implements C++11 or later, boost will automatically use --- End diff -- Got it, I can correct this. I'm still dealing with aligning the stars on this one. Lots of namespace and using cleanup, and we will no longer work with Visual Studio 2010 and 2012 in C++0x/C++11 mode; 2013 will be required for C++11 because the solution requires template aliases. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ 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 + +/// +// +// functional (function, bind) +// +/// + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include +#define _THRIFT_FUNCTIONAL_TR1_ 1 +#endif + +#if _MSC_VER == 1600 +#include +#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 + + 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 +#else +#include + #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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118751#comment-16118751 ] 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_r131985042 --- 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 + +/// +// +// functional (function, bind) +// +/// + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include +#define _THRIFT_FUNCTIONAL_TR1_ 1 +#endif + +#if _MSC_VER == 1600 +#include +#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 + + 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 +#else +#include + #if __cplusplus < 201103L --- End diff -- What is this test for? BOOST_NO_CXX11_SMART_PTR told us above that c++11 samart 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118619#comment-16118619 ] ASF GitHub Bot commented on THRIFT-2221: Github user hcorg commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r131968863 --- 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 + +/// +// +// functional (function, bind) +// +/// + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) +#include +#define _THRIFT_FUNCTIONAL_TR1_ 1 +#endif + +#if _MSC_VER == 1600 +#include +#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 + + 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 +#else +#include + #if __cplusplus < 201103L +#include + #endif +#endif + +namespace apache { namespace thrift { namespace stdcxx { + +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR) + + using ::boost::const_pointer_cast; + using ::boost::dynamic_pointer_cast; + using ::boost::enable_shared_from_this; + using ::boost::make_shared; + using ::boost::scoped_ptr; + using ::boost::shared_ptr; + using ::boost::static_pointer_cast; + using ::boost::weak_ptr; + +#else + + using ::std::const_pointer_cast; + using ::std::dynamic_pointer_cast; + using ::std::enable_shared_from_this; + using ::std::make_shared; + // yes, they renamed in in std:: for some reason... --- End diff -- unnecessary comment - `scoped_ptr` and `unique_ptr` are quite different (`scoped_ptr` can't be moved) so it's not like standard committee did something wrong ;) (at least with naming it `unique_ptr`) > Generate c++ code with std::shared_ptr instead of boost::shared_ptr. > > >
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118614#comment-16118614 ] ASF GitHub Bot commented on THRIFT-2221: Github user hcorg commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r131968203 --- Diff: lib/cpp/README.md --- @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent. ## Dependencies -boost shared pointers -http://www.boost.org/libs/smart_ptr/smart_ptr.htm +If your C++ environment implements C++11 or later, boost will automatically use --- End diff -- Even if boost itself provides mapping to `std::` pointers, next sentence suggests that boost is not needed. Some little clean up could help confused users ;) (this is also first place in README.md where boost is mentioned, hence the potential confusion) > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118603#comment-16118603 ] ASF GitHub Bot commented on THRIFT-2221: Github user hcorg commented on a diff in the pull request: https://github.com/apache/thrift/pull/1328#discussion_r131966861 --- Diff: lib/cpp/README.md --- @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent. ## Dependencies -boost shared pointers -http://www.boost.org/libs/smart_ptr/smart_ptr.htm +If your C++ environment implements C++11 or later, boost will automatically use --- End diff -- `If your C++ environment implements C++11 or later, boost will automatically use` - boost or Thrift? > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16115459#comment-16115459 ] ASF GitHub Bot commented on THRIFT-2221: GitHub user jeking3 opened a pull request: https://github.com/apache/thrift/pull/1328 THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr) I had to close my older pull request because the history got tainted, so I am reopening it with the suggestions from Jira. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jeking3/thrift THRIFT-2221 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1328.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1328 commit 95f90ecde41fd60e99779c472a24480a39672060 Author: James E. King, III Date: 2017-08-05T16:23:54Z THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr) > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16115437#comment-16115437 ] ASF GitHub Bot commented on THRIFT-2221: Github user jeking3 closed the pull request at: https://github.com/apache/thrift/pull/1256 > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036873#comment-16036873 ] Mike Gresens commented on THRIFT-2221: -- In my option std::unique_ptr is always available if C++11. See http://en.cppreference.com/w/cpp/memory/unique_ptr See http://www.boost.org/doc/libs/1_64_0/libs/config/doc/html/boost_config/boost_macro_reference.html @ BOOST_NO_CXX11_SMART_PTR So the block {code} + #if __cplusplus >= 201103L && (defined(__clang__) || __cpp_alias_templates >= 200704) +using scoped_ptr = std::unique_ptr; + #else +using ::boost::scoped_ptr; {code} can be replaced by {code} template using scoped_ptr = std::unique_ptr; {code} And remove the block {code} + #if __cplusplus < 201103L +#include + #endif {code} Mike... > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036853#comment-16036853 ] Mario Emmenlauer commented on THRIFT-2221: -- I think this is the problem, but I do not understand the first '#if' well enough to solve it. Why is boost/scoped_ptr.hpp included if "__cplusplus < 201103L" ? I do not fully understand the multiple conditions in this file, maybe [~jking3] can help? > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036846#comment-16036846 ] Mike Gresens commented on THRIFT-2221: -- Mario, may be is not includes but used later: {code} + #if __cplusplus < 201103L +#include + #endif {code} and {code} + #if __cplusplus >= 201103L && (defined(__clang__) || __cpp_alias_templates >= 200704) +using scoped_ptr = std::unique_ptr; + #else +using ::boost::scoped_ptr; {code} Does the two #if's always match?! # #if __cplusplus < 201103L # #if __cplusplus >= 201103L && (defined(__clang__) || __cpp_alias_templates >= 200704) Mike... > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036380#comment-16036380 ] Mario Emmenlauer commented on THRIFT-2221: -- The patch works on several Linux derivates, but not on all. On CentOS 7.3 and Ubuntu 14.04 I get an error: {code} [...] In file included from /data/thrift-trunk-r2b1b32c/lib/cpp/src/thrift/async/TAsyncChannel.h:23:0, from /data/thrift-trunk-r2b1b32c/lib/cpp/src/thrift/async/TAsyncChannel.cpp:20: /data/thrift-trunk-r2b1b32c/lib/cpp/src/thrift/stdcxx.h:129:20: error: 'boost::scoped_ptr' has not been declared using ::boost::scoped_ptr; ^ {code} > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16036097#comment-16036097 ] Mario Emmenlauer commented on THRIFT-2221: -- Thanks [~msg-72]! This is the key. When I change {code} + #if __cplusplus >= 201103L && (defined(__clang__) || __cpp_alias_templates >= 200704) +using scoped_ptr = std::unique_ptr; + #else {code} to {code} + #if __cplusplus >= 201103L && (defined(__clang__) || __cpp_alias_templates >= 200704) +template using scoped_ptr = std::unique_ptr; + #else {code} it builds fine! I'm very curious to test the C++11 pointers, thanks! Can't wait for the rest of the C++11 code cleanup... > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035060#comment-16035060 ] Mike Gresens commented on THRIFT-2221: -- Mario, try: template using scoped_ptr = std::unique_ptr; Mike... > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16034550#comment-16034550 ] Mario Emmenlauer commented on THRIFT-2221: -- Dear [~jking3], is there a cummulative patch with all your changes with respect to all your C++11 related work? > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980573#comment-15980573 ] James E. King, III commented on THRIFT-2221: I also found namespace pollution all over the place in headers, and I have removed it... in the next push. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980411#comment-15980411 ] Mario Emmenlauer commented on THRIFT-2221: -- Two thumbs up for the great work!!! > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980407#comment-15980407 ] James E. King, III commented on THRIFT-2221: Things a developer shouldn't say: {quote}It should be fairly easy to to.{quote} Not that it isn't fun, but oh boy is boost embedded into everything we have... {noformat} #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include {noformat} There are places we could do much better; our current mutex implementation isn't even polymorphic (there's no base class) - we just compile in different classes. We could have a single Mutex class for std and boost that uses the same technique as this ticket. I don't see us being divorced from boost any time soon... so we have to focus on making our interfaces use as many C++11 compatible items as possible, such as this ticket does. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980217#comment-15980217 ] James E. King, III commented on THRIFT-2221: This same technique for stdcxx.h can be used to redirect boost::atomic to std::atomic, etc... I'm planning on using it in a number of projects to make them C++xyz friendly. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980216#comment-15980216 ] James E. King, III commented on THRIFT-2221: [~hcorg] Good point; let's see how many there were in the code review, inside critical areas, and if they are not in an interface they can specifically be changed back to use either boost::scoped_ptr or std::unique_ptr. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980068#comment-15980068 ] ASF GitHub Bot commented on THRIFT-2221: GitHub user jeking3 opened a pull request: https://github.com/apache/thrift/pull/1256 THRIFT-2221: detect C++11 and use std namespace for memory operations (shared_ptr) You can merge this pull request into a Git repository by running: $ git pull https://github.com/jeking3/thrift THRIFT-2221 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1256.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1256 commit 3ea6ca54d959d71c9f183515b5733aae004d99a2 Author: James E. King, III Date: 2017-04-22T14:46:59Z THRIFT-2221: detect C++11 and use std namespace for memory operations (shared_ptr) > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980020#comment-15980020 ] Mario Emmenlauer commented on THRIFT-2221: -- Great work, I'm very curious to test it! > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15979967#comment-15979967 ] Konrad Grochowski commented on THRIFT-2221: --- quick note: `scoped_ptr` to `shared_ptr` will result in major performance degradation. In C++11 mode we could use `using` construct to "rename" `unique_ptr` to `apache::stdcxx::scoped_ptr`. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15979958#comment-15979958 ] James E. King, III commented on THRIFT-2221: I was able to isolate the following concepts such that if C++11 is present at build time they are used from {{std::}} instead of {{boost::}} * const_pointer_cast * dynamic_pointer_cast * enable_shared_from_this * make_shared * shared_ptr * static_pointer_cast * weak_ptr The others are not in C++11 yet such as reinterpret_pointer_cast; and scoped_ptr has been replaced in std:: with unique_ptr so I changed all references of it to stdcxx::shared_ptr instead. I moved {{}} to {{}} and added this new logic, and changed all the source code files so none of the boost headers or namespaces are referenced any more for those items. I also removed the "tcxx" namespace as it is not good to define a top level namespace like "tcxx" which could conflict with a consuming application's namespace. These concepts are in {{apache::thrift::stdcxx::}}. It seems to be working out well so I will submit a PR shortly. > 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.3.15#6346)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972998#comment-15972998 ] James E. King, III commented on THRIFT-2221: It should be fairly easy to to. I can add it. I'll assign this one to myself for now. > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972900#comment-15972900 ] Mario Emmenlauer commented on THRIFT-2221: -- This looks like a very suitable solution, and only moderate effort to make. I think many people nowadays use std::shared_ptr so I think the benefit is worthwhile, what do you think? Could you implement this change? Or should I give it a try, and would a PR with this change be accepted? > 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ 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 #if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR) #include #else #include #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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ 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 #define shared_ptr_namespace boost #else #include #define shared_ptr_namespace std #endif {code} And in the code change: {code} -boost::shared_ptr socket(new TSocket("127.0.0.1", port)); +shared_ptr_namespace::shared_ptr 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)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922091#comment-13922091 ] Dima Korolev commented on THRIFT-2221: -- Hi, $0.02: I've put together a small piece of code that illustrates the issue along with a quick workaround: https://github.com/dkorolev/marvin/blob/master/test/README.md Glad to see you're on it! Thanks, Dima > 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.2#6252)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13788158#comment-13788158 ] Henrique Mendonça commented on THRIFT-2221: --- Hi Chris, I was also just looking for this ticket THRIFT-1753, thanks Ben. It would be nice to get rid of the dependency, it would make it a lot easier to maintain and build Thrift. But we need to keep compatibility, which could be achieved by a switch in the compiler and loads of preprocessor directives in the library. It's quite a long list of changes, as Randy mentioned on the same ticket. I think it would be a valid patch if you want to go through it and make both work with the same code base. Otherwise, I would close this for now. Thanks for the input. > 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.1#6144)
[jira] [Commented] (THRIFT-2221) Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
[ https://issues.apache.org/jira/browse/THRIFT-2221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13788127#comment-13788127 ] Ben Craig commented on THRIFT-2221: --- This probably isn't happening for a while. See some related discussion in the comments of THRIFT-1753. Switching to std::shared_ptr would also prevent people without C++11 compilers from using Thrift. For example, I need to compile binaries for RHEL 5 and RHEL 6 systems. Those Linux distributions ship with GCC 4.1 and GCC 4.4 respectively. There isn't a newer RHEL to upgrade to, at least there isn't as of 10/7/2013. > 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.1#6144)