From 3c59f2bf5eadb066dd97c07652506594054c1cc6 Mon Sep 17 00:00:00 2001 From: nil Date: Wed, 3 Aug 2016 12:38:09 +0200 Subject: [PATCH] Allow compilation on MSVC with /P This patch makes it possible to use this header in programs built using the FASTbuild (http://fastbuild.org) and more precisely its caching feature. Considering the following code: clmacro.cpp: ```c++ int main(void) { #define funny_type(x) x funny_type(int)const a = 2; // cl.exe -P clmacro.cpp -> `intconst a` } ``` On MSVC (Visual Studio 2013) Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86 Copyright (C) Microsoft Corporation. All rights reserved. This compiles correctly by default with `CL.exe` ``` Cl.exe clmacro.cpp ``` However when using the `/P` compilation flag to obtain the pre-processed source, then trying to compile the resulting file this will fail because const gets stitched to the other symbol before compilation. See: ``` cl.exe -P -Ficlmacro.i.cpp clmacro.cpp && cl.exe clmacro.i.cpp ``` --- include/boost/icl/detail/element_iterator.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/icl/detail/element_iterator.hpp b/include/boost/icl/detail/element_iterator.hpp index 111f209..0d813fa 100644 --- a/include/boost/icl/detail/element_iterator.hpp +++ b/include/boost/icl/detail/element_iterator.hpp @@ -113,7 +113,7 @@ struct elemental; }; template< class CodomainT, ICL_INTERVAL(ICL_COMPARE) Interval > - struct elemental > + struct elemental > { typedef std::pair segment_type; typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type; @@ -214,7 +214,7 @@ struct segment_adapter }; template < class SegmentIteratorT, class CodomainT, ICL_INTERVAL(ICL_COMPARE) Interval > -struct segment_adapter > +struct segment_adapter > { typedef segment_adapter type; typedef ICL_INTERVAL_TYPE(Interval,DomainT,Compare) interval_type; -- 2.9.0.windows.1