Click here to Skip to main content
11,438,226 members (72,696 online)
Click here to Skip to main content
Add your own
alternative version

Combinations in C++

, 13 Sep 2009 CPOL
An article on finding combinations.
#include <vector>
#include "combination.h"

template<class T>
bool FindVecComb(
	std::vector< std::vector< T > >& VecN,
	std::vector< std::vector< T > >& VecR
	if(VecR.size() == 0)
		return false;

	size_t nDepth = VecR.size()-1;
	bool NoMore = true;
		NoMore = stdcomb::next_combination(,,, );

		if(NoMore == false)
			// Initailize as before
			for( size_t i=0; i<; ++i)
			{ =;

		if( nDepth == 0 && NoMore == false)
			return false;

	while(NoMore == false);

	return true;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Shao Voon Wong
Software Developer
Singapore Singapore
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150506.1 | Last Updated 13 Sep 2009
Article Copyright 2003 by Shao Voon Wong
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid