[Liblas-devel] libLAS and VS2010

Andrew Bell andrew.bell.ia at gmail.com
Tue Jan 11 09:07:16 EST 2011


Not that I've tried it, but can't you just #undef min and #undef max
after you've included the windows header?

On Tue, Jan 11, 2011 at 3:56 AM, esteban70 at libero.it
<esteban70 at libero.it> wrote:
>>----Messaggio originale----
>>Da: mpg at flaxen.com
>>Data: 10/01/2011 23.55
>>A: <liblas-devel at lists.osgeo.org>
>>Ogg: Re: R: Re: [Liblas-devel] libLAS and VS2010
>>
>>Esteban70, can you send a simple main() that replicates this problem?
>
> Create a MFC application using the wizard and put "#include <liblas/liblas.
> hpp>" in any file you want.
>
> I'm not saying to change std::numeric_limits<T>::min function call but to
> put () around it, if it's necessary.
>
> This was already discussed with Mateusz
> http://mateusz.loskot.net/2010/01/27/illegal-token-on-right-side-of/
>
> These are boost guidelines:
>
> Make sure your code compiles in the presence of the min() and max() macros.
> Some platform headers define min() and max() macros which cause some common C++
> constructs to fail to compile. Some simple tricks can protect your code from
> inappropriate macro substitution:
>
>    * If you want to call std::min() or std::max():
>          o If you do not require argument-dependent look-up, use (std::min)(a,
> b).
>          o If you do require argument-dependent look-up, you should:
>                + #include <boost/config.hpp>
>                + Use BOOST_USING_STD_MIN(); to bring std::min() into the
> current scope.
>                + Use min BOOST_PREVENT_MACRO_SUBSTITUTION (a,b); to make an
> argument-dependent call to min(a,b).
>    * If you want to call std::numeric_limits<int>::max(), use (std::
> numeric_limits<int>::max)() instead.
>    * If you want to call a min() or max() member function, instead to doing
> obj.min(), use (obj.min)().
>    * If you want to declare or define a function or a member function named
> min or max, then you must use the BOOST_PREVENT_MACRO_SUBSTITUTION macro.
> Instead of writing int min() { return 0; } you should write int min
> BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } This is true regardless if
> the function is a free (namespace scope) function, a member function or a
> static member function, and it applies for the function declaration as well as
> for the function definition.
>
> http://www.boost.org/development/requirements.html
>
> Frank
> _______________________________________________
> Liblas-devel mailing list
> Liblas-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/liblas-devel
>



-- 
Andrew Bell
andrew.bell.ia at gmail.com


More information about the Liblas-devel mailing list