Click here to Skip to main content
12,444,790 members (52,132 online)
Click here to Skip to main content


65 bookmarked

Combinations in C++

, 12 Apr 2016 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 (Senior)
United States United States
IT Certifications

  • IT Infrastructure Library Foundational (ITIL v3)
  • Scrum Alliance Certified Scrum Master (CSM)
  • EC-Council Certified Secure Programmer (ECSP) .NET
  • EC-Council Certified Ethical Hacker (CEH)
  • EC-Council Certified Security Analyst (ECSA)
  • Certified Secure Software Lifecycle Professional (CSSLP)

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160811.3 | Last Updated 12 Apr 2016
Article Copyright 2016 by Shao Voon Wong
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid