Boost logo

Boost Users :

Subject: Re: [Boost-users] [heap] Mix use of size_t and size_type
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2015-03-12 05:52:13

> -----Original Message-----
> From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Ben Pope
> Sent: 12 March 2015 01:56
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [heap] Mix use of size_t and size_type
> On Thursday, March 12, 2015 07:06 AM, Gavin Lambert wrote:
> > If you're referring to the parentheses around std::min itself, that's
> > a standard defense against #define min().
> Thanks, never seen that used before.

This is really quite important to avoid difficult-to-diagnose trouble when using Windows, whose code
often makes a daft #define for min.

So important, that Boost has a tool to check for it called 'Inspect' that reports all sorts of
naughtiness, including this.

Build the tool inspect.exe by cd to


and running b2 to build inspect.exe

Then cd to the top of your code, eg /libs/your_library and run inspect from there

(perhaps inspect.exe > my_inspect.html)

You will get some spurious complaints, but you can pick out all uses of min() and max() without
protective brackets.

Should be, for example,



Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at