CPP/STL const map 객체에 [key] 접근시 에러
#include #include #include int _tmain(int argc, _TCHAR* argv[]){std::map dict1({ { "AAA", { 1, 2, 0, 0 } },{ "B", { 2 } }});const std::map dict2({{ "abc", { 3, 3, 1, 0 } },{ "def", { 0 } }}); // okstd::vector v1 = dict1["AAA"]; // compile error!// ref : http://stackoverflow.com/questions/15614735/why-stdmapint-float-cant-use-operator-error-c2678// dict2 가 const 로 정의되어 있음.// [ 연산자는 자동으로 새로운 key, ..
electrons on sphere
E denoted by (theta, phi). rho is fixed as R. E in cartesian coord is R ( sin(theta) cos(phi), sin(theta) sin(phi), cos(theta) ) F on E[i] is SUM_(k!=i) X(E[i]-E[k]) ----class X3: x, y, z def __init__(self, x, y, z): self.x, self.y, self.z = x, y, z def plus(self, Y): return X3(self.x + Y.x, self.y + Y.y, self.z + Y.z) ... ----class E : r = R th = 0 ph = 0 v = X3(0, 0, 0) def __init__(self, thet..