Alexander Grund via Boost said: (by the date of Wed, 6 Jan 2021 09:47:03 +0100)
Using reserved names (i.e. some names starting with underscore) is outright UB in C++ and hence mustn't be used.
Hi, (I'm sorry to hijack a little bit) I am planning to implement units in YADE [1][2], and initially I wanted to use _m _km _s names, so that I could write: 1.0_km instead of 1.0km Then I decided against it, because of UB. Then I saw in boost ublas tensor this example: Cem Bassoy via Boost said: (by the date of Wed, 6 Jan 2021 10:32:15 +0100)
Please consider to use and contribute to *Boost.uBlas* https://github.com/boostorg/ublas which recently added *tensor* data types and operations with the convenient Einstein notation :
tensor_t C = C + A(_i,_j,_k)*B(_j,_l,_i,_m) + 5;
Which is using exactly the notation which I need: 10_kPa is easier to read than 10kPa, or 10_Pa vs 10Pa So. Where exactly do we have UB ? Would simply putting it into separate namespace yade::units solve the problem? Are there only certain letters forbidden after a starting underscore? I plan to add user defined literals for all SI, atomic units and later astrophysical units. best regards Janek Kozicki [1] http://yade-dem.org/ [2] https://en.cppreference.com/w/cpp/language/user_literal -- Janek Kozicki, PhD. DSc. Arch. Assoc. Prof. GdaĆsk University of Technology Faculty of Applied Physics and Mathematics Department of Theoretical Physics and Quantum Information -- http://yade-dem.org/ http://pg.edu.pl/jkozicki (click English flag on top right)