mirror of
https://github.com/boostorg/fusion.git
synced 2026-01-26 00:52:19 +01:00
Compilers implement a multiple-include optimization where they avoid preprocessing an included file if it is "properly guarded". Compilers differ as to what constitutes a "properly guarded" file. In particular, Microsoft Visual Studio does not recognize `#if !defined(GUARD)` for the optimization. This does not affect the correctness of using Fusion on Microsoft Visual Studio, but it will increase the time taken to build any project on this compiler. This commit changes all include guards to use `#ifndef`, but leaves all other `#if !defined` preprocessor directives that are not related to guarding a file. Co-authored-by: IncludeGuardian <hello@includeguardian.io>
68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
/*=============================================================================
|
|
Copyright (c) 2001-2011 Joel de Guzman
|
|
Copyright (c) 2005-2006 Dan Marsden
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
==============================================================================*/
|
|
#ifndef BOOST_FUSION_AT_IMPL_20060223_2017
|
|
#define BOOST_FUSION_AT_IMPL_20060223_2017
|
|
|
|
#include <string>
|
|
#include <boost/mpl/if.hpp>
|
|
#include <boost/mpl/int.hpp>
|
|
#include <boost/type_traits/is_const.hpp>
|
|
|
|
namespace example
|
|
{
|
|
struct example_sequence_tag;
|
|
}
|
|
|
|
namespace boost { namespace fusion {
|
|
|
|
namespace extension
|
|
{
|
|
template<typename Tag>
|
|
struct at_impl;
|
|
|
|
template<>
|
|
struct at_impl<example::example_sequence_tag>
|
|
{
|
|
template<typename Sequence, typename Key>
|
|
struct apply;
|
|
|
|
template<typename Sequence>
|
|
struct apply<Sequence, mpl::int_<0> >
|
|
{
|
|
typedef typename mpl::if_<
|
|
is_const<Sequence>,
|
|
std::string const&,
|
|
std::string&>::type type;
|
|
|
|
static type
|
|
call(Sequence& seq)
|
|
{
|
|
return seq.name;
|
|
};
|
|
};
|
|
|
|
template<typename Sequence>
|
|
struct apply<Sequence, mpl::int_<1> >
|
|
{
|
|
typedef typename mpl::if_<
|
|
is_const<Sequence>,
|
|
int const&,
|
|
int&>::type type;
|
|
|
|
static type
|
|
call(Sequence& seq)
|
|
{
|
|
return seq.age;
|
|
};
|
|
};
|
|
};
|
|
}
|
|
}}
|
|
|
|
#endif
|