Boost logo

Boost Users :

Subject: Re: [Boost-users] Trouble with std::forward and fusion vector using clang 3.4 and older library - is there a workaround?
From: Stan Blakey (stan_at_[hidden])
Date: 2016-12-15 06:42:35


Hi Kohei,
 Sorry it is without --std=c++11 that every thing is fine.
  The boost code manages to solve not having std::forward when compiled
without the std=c++11 flag.

  With --std=c++11 I get the compiler errors about missing std::forward.

  I have tried all the boost macros that pertain to library features with
no success. I did at the option BOOST_NO_CXX11_CONSTEXPR and this doesn't
work either. The compiler is the full clang 3.4 and does support c++11
features such as constexpr. It is the library that is old.

std::printf("GLIBCXX: %d\n",__GLIBCXX__);

produces

GLIBCXX: 20070514

Below is the full source with all the macros I have on:

Stan

*#define* BOOST_NO_CXX11_HDR_TYPE_TRAITS

*#define* BOOST_NO_CXX11_HDR_ATOMIC

*#define* BOOST_NO_CXX11_HDR_ARRAY

*#define* BOOST_NO_CXX11_HDR_CHRONO

*#define* BOOST_NO_CXX11_HDR_CODECVT

*#define* BOOST_NO_CXX11_HDR_CONDITION_VARIABLE

*#define* BOOST_NO_CXX11_HDR_FORWARD_LIST

*#define* BOOST_NO_CXX11_HDR_FUNCTIONAL

*#define* BOOST_NO_CXX11_HDR_FUTURE

*#define* BOOST_NO_CXX11_HDR_INITIALIZER_LIST

*#define* BOOST_NO_CXX11_HDR_MUTEX

*#define* BOOST_NO_CXX11_HDR_RANDOM

*#define* BOOST_NO_CXX11_HDR_RATIO

*#define* BOOST_NO_CXX11_HDR_SYSTEM_ERROR

*#define* BOOST_NO_CXX11_HDR_THREAD

*#define* BOOST_NO_CXX11_HDR_TUPLE

*#define* BOOST_NO_CXX11_HDR_TYPEINDEX

*#define* BOOST_NO_CXX11_HDR_TYPE_TRAITS

*#define* BOOST_NO_CXX11_HDR_UNORDERED_MAP

*#define* BOOST_NO_CXX11_NUMERIC_LIMITS

*#define* BOOST_NO_CXX11_SMART_PTR

*#define* BOOST_NO_CXX11_STD_UNORDERED

*#define* BOOST_NO_CXX11_ADDRESSOF

*#define* BOOST_NO_CXX11_ALLOCATOR

*#define* BOOST_NO_CXX11_ATOMIC_SMART_PTR

*#undef* BOOST_FUSION_HAS_VARIADIC_VECTOR

*#include* <boost/fusion/tuple.hpp>

*#include* <boost/fusion/algorithm.hpp>

*#include* <string>

*#include* <iostream>

#include <cstdio>

*using* *namespace* boost::fusion;

*struct* print

{

*template* <*typename* *T*>

*void* *operator()*(*const* *T* &t) *const*

{

std::cout << std::boolalpha << t << '\n';

}

};

*int* *main*()

{

*#ifdef* __GLIBCPP__

std::printf("GLIBCPP: %d\n",__GLIBCPP__);

*#endif*

*#ifdef* __GLIBCXX__

std::printf("GLIBCXX: %d\n",__GLIBCXX__);

*#endif*

*typedef* tuple<*int*, std::string, *bool*, *double*> tuple_type;

tuple_type t(10,"Boost", *true*, 3.14);

for_each(t, print());

}

On Thu, Dec 15, 2016 at 2:59 AM, Kohei Takahashi <flast_at_[hidden]> wrote:

> Hi Stan,
>
> Sorry for quite late reply.
> On 2016/12/06 22:42, Stan Blakey wrote:
>
> With the -std=c++11 it compiles and runs without any issue.
> With -std=c++11 I get
>
> Which line is correct?
>
> boost_1_60_0\boost/fusion/container/vector/vector.hpp:126:20: error: no
> template named 'forward' in namespace 'std'; did you mean
> 'advance_detail::forward'?
>
> return std::forward<result>(*advance_c<N>(begin(seq)));
> and many similar errors.
>
> Which standard library (and its version) are you using?
>
> If your standard library provides `std::forward` and it functions
> normally, try `BOOST_NO_CXX11_CONSTEXPR`.
>
> Kohei Takahashi
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net