|
Boost : |
Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-08-11 14:44:47
On Wed, Aug 11, 2010 at 2:27 AM, Stefan van Kessel
<van_kessel_at_[hidden]> wrote:
> On 8/11/2010 12:28 AM, Dave Abrahams wrote:
>
>> Could you please make note of this in a Trac ticket? Otherwise it's
>> liable to get lost.
>
> Done. The Ticket # is 4526.
>
> With very little testing, the following code fixes the issue for me on
> MSVC10. I just tried avoiding non-type template arguments.
Thanks a lot! I am trying to use your code to implement a workaround
within my library and eventually remove it when/if the workaround is
implemented within Boost.ConceptCheck. I have a couple of questions
below.
> #elif BOOST_WORKAROUND(BOOST_MSVC, == 1600)
I have this error on _MSC_VER 1400 (MSVC8?) so I was thinking to use:
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
... // Workaround wrapper for BOOST_CONCEPT_CHECK following your code below.
#else
... // Original BOOST_CONCEPT_CHECK with no workaround.
#endif
> template <typename T1, typename T2>
> struct requires_msvc10
> {
> typedef typename T2::type type;
> };
>
> template <typename T>
> struct relay_type_msvc10
> {
> typedef T type;
> };
>
> #define BOOST_CONCEPT_STRIP_PARENS(x) x
> #define BOOST_CONCEPT_TEST_SINGLE_REQUIREMENT(x) \
> decltype(::boost::_requires_<void(*) (x) >::value)
I don't have `decltype()` (I think that is a C++0x feature...). What
shall I use instead? Boost.TypeOf somehow? Can you please sketch the
code without `decltype()`?
> #define BOOST_CONCEPT_CLOSE_TEMPLATE(r, data, elem) >
> #define BOOST_CONCEPT_OPEN_TEMPLATE(r, data, i, elem) \
> ::boost::requires_msvc10< BOOST_CONCEPT_TEST_SINGLE_REQUIREMENT elem ,
>
> #define BOOST_CONCEPT_REQUIRES(models , result)
> \
> typename
> \
> BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_OPEN_TEMPLATE, 0, models)
> \
> ::boost::relay_type_msvc10< BOOST_CONCEPT_STRIP_PARENS
> result> \
> BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_CLOSE_TEMPLATE, 0,
> models) \
> ::type
-- Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk