Click here to Skip to main content
12,998,654 members (130,879 online)
Click here to Skip to main content


68 bookmarked
Posted 12 Apr 2016

Combinations in C++

, 12 Apr 2016
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

Cake Processor
Software Developer (Senior)
United States United States
IT Certifications

  • IT Infrastructure Library Foundational (ITIL v3)

  • Scrum Alliance Certified Scrum Master (CSM)

  • EC-Council Certified Security Analyst (ECSA)

  • Certified Secure Software Lifecycle Professional (CSSLP)

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170622.1 | Last Updated 12 Apr 2016
Article Copyright 2016 by Cake Processor
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid