This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A deeper look at coercion. | |
This is both an elaboration on a few points that were touched on | |
in ab5tract's Day 4 advent post, and a deep look at the definition | |
of "coerce" focusing on the soon-to-be-timely subject of buffers | |
and native data types, and "coercive types". | |
The most important part of the specification when it comes to | |
defining what it means to "coerce" is this (in S02): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <vector> | |
#include <iostream> | |
#define ANY_OP(T, OP) bool operator OP(T el) { \ | |
for (const auto& elem : _elems) { \ | |
if (elem OP el) return true; \ | |
} \ | |
return false; \ | |
} |