logoalt Hacker News

spacechild1yesterday at 3:32 PM1 replyview on HN

That's the comma operator. I didn't know you could overload it! That's pretty crazy. However, I have never seen anyone do that. Do you have any real world examples?


Replies

addaonyesterday at 10:38 PM

See e.g. the very-popular Eigen library, in which the type CommaInitializer basically exists for the sole purpose of overloading `operator,`, allowing a cleaner matrix initialization syntax.

https://gitlab.com/libeigen/eigen/blob/master/Eigen/src/Core...