Macro Combinatorics

Правка en1, от akifpatel, 2020-06-16 18:17:35

I'm sure other people have already come up with similar ideas, but I wanted to share this cool trick.

Introduction

C++ has next_permutation which is very nice, but what about all the other combinatorics functions? Python has the very nice itertools library, but what should you do in C++ when you need to write a brute force solution that uses things like combinations, cartesian product/power, etc. Will you have to write the annoying (and quite large overhead) recursive backtracking? In this blog I show a light, efficient, and quite general way to do this type of thing using macros.

Теги #combinatorics, #brute force, #implementation, #c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский akifpatel 2020-06-28 08:52:25 0 (published)
en5 Английский akifpatel 2020-06-28 08:51:37 2675 Tiny change: 'ents from $c[]$ as indice' -> 'ents from `c[]` as indice'
en4 Английский akifpatel 2020-06-16 21:51:17 1272
en3 Английский akifpatel 2020-06-16 21:26:18 449
en2 Английский akifpatel 2020-06-16 21:18:24 174
en1 Английский akifpatel 2020-06-16 18:17:35 622 Initial revision (saved to drafts)