Update introduction.md to include XOR

Boolean operator xor (^) is now included in the concept.

See Update introduction.md to include XOR by sbromberger · Pull Request #622 · exercism/cpp (github.com) for the (closed) PR.

…and I see we might be making a distinction between bitwise operators and boolean operators, even when the former applies to booleans. In this case, xor is either not in scope (because it’s technically bitwise), or my precedence is wrong (it’s actually the highest precedence behind “logical not”). Feel free to ignore if the introduction is meant to cover boolean/logical operators only.

If this were added, it should go into about.md rather than introduction.md. See Concepts | Exercism's Docs. (That the about.md is currently empty is a bug that I just notified the maintainer of.)

However, I question the value of adding this to this particular concept node. To me, it seems that XOR is not, in practice, an operation on booleans. Instead, it tends to operate on bits.

Not to say that all constructs should be confined to single concept nodes, but a concept node about bit operations seems like a better place for XOR.

Disagree with your first paragraph, agree in principle with your second.

(introduction.md currently houses the description and use of the other operators, so it made sense to me to put xor there as well. about.md is currently empty.)

Edited because I seem to have missed your parenthetical. Sorry.

Hello sbromberger,

thanks for your interest in the track. I try to put a lot of effort into it to make it great for everyone. So every feedback is very much appreciated.

I kept the scope according to the logical operators from the cppreference.
Xor is used by them exclusively as a bitwise operator.

I agree, that we can show the students that it is possible to use xor with booleans, but I would rather wait and introduce them in the bitwise operator section of the syllabus.

If you want the compiler’s opinion, you can run:

#include <iostream>
#include <typeinfo>
int main() {
        auto xorresult = true xor false;
        auto andresult = true and false;
        std::cout << typeid(xorresult).name() << std::endl;
        std::cout << typeid(andresult).name() << std::endl;
}

It will tell you that xor returns an integer, and that and returns a boolean. I would thus put them in their respective categories.

Do you think that is sensible?

By the way, @sbromberger: how did you find this concept node? The syllabus shouldn’t be public yet; there might be a bug.

This makes perfect sense. Thanks for the reply and for the great overview.

It’s pushed under concepts on the c++ track:

@ErikSchierboom :point_up: the announcement of non-public ‘publications’ looks like a bug to me.