|
Boost : |
Subject: Re: [boost] combinations and permutations
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-01-04 16:08:43
At Tue, 4 Jan 2011 11:30:02 -0500,
Howard Hinnant wrote:
>
> > Hi Howard,
> >
> > Neat stuff! Was there a real-world use case driving this work, or are
> > you just going all Knuth on us in your copious spare time?
>
> One of my first applications of for_each_combination was for writing
> unit tests for rvalue reference overloading. This was done in 2004
> or 2005, and so those tests are now obsolete due to the language
> changes since then. But in a nutshell I needed to write tests that
> covered every combination of passing an lvalue or rvalue,
> not-cv-qualified, const, volatile and const volatile qualified, to a
> set of overloaded set of functions each taking one parameter. That
> one parameter was a cv-qaulified lvalue or rvalue reference (each
> combination). And I needed to consider all combinations of that set
> of 8 overloaded functions 1 at a time, 2 at time, etc. up to 8 at a
> time.
>
> Here is one file containing just 8 tests that considered all 8
> overloads at once:
Hah, I wouldn't have guessed you did this to solve a metaprogramming
problem!
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk