Redian新闻
>
求建议一些做理论好的学校
avatar
求建议一些做理论好的学校# Economics - 经济
g*s
1
class A {
public:
A() {}
~A() {}
...
};
std::map M;
std::map::iterator it = M.find("hello");
if (it==M.end()) M["hello"]=A();
合法但风格不好,还是很正常的用法?看着别扭。
avatar
t*y
2
如题, 希望是做宏观的. 谢谢
avatar
t*t
3
很奇怪的写法,看上去是要找"hello",如果没有就添一个,那直接写
M["hello"];
就行了。要写得清楚一点就可以写
M.insert(std::make_pair(std::string("hello"), A()));
不过我觉得还不如上面的清楚呢。。。

【在 g*********s 的大作中提到】
: class A {
: public:
: A() {}
: ~A() {}
: ...
: };
: std::map M;
: std::map::iterator it = M.find("hello");
: if (it==M.end()) M["hello"]=A();
: 合法但风格不好,还是很正常的用法?看着别扭。

avatar
g*y
4
chicago, minnesota, rochester...
avatar
c*z
5
M["hello"] 返回值事什么类型的啊

【在 t****t 的大作中提到】
: 很奇怪的写法,看上去是要找"hello",如果没有就添一个,那直接写
: M["hello"];
: 就行了。要写得清楚一点就可以写
: M.insert(std::make_pair(std::string("hello"), A()));
: 不过我觉得还不如上面的清楚呢。。。

avatar
t*y
6

听说minnesota的宏观非但是强, 而且极有特色. 哪位能简单介绍一下么?

【在 g********y 的大作中提到】
: chicago, minnesota, rochester...
avatar
g*s
7
Oh,确实是要做find_or_create的。有个findonly tag。按你的意见,这个?
it = M.find("hello");
if (it==M.end()) {
if (findonly) return NULL;
// findonly mode. return NULL if no hit
else {
return &M["hello"];
// create mode. create an entry if no hit.
}
}
或者这样?
if (findonly) {
it = M.find(hello);
return (it!=M.end()?&M["hello"]:NULL);
} else return &M["hello"];
更简洁写法:return (!findonly||it!=M.end()?&M["hello"]:NULL); 不过这个有点费
解了。

【在 t****t 的大作中提到】
: 很奇怪的写法,看上去是要找"hello",如果没有就添一个,那直接写
: M["hello"];
: 就行了。要写得清楚一点就可以写
: M.insert(std::make_pair(std::string("hello"), A()));
: 不过我觉得还不如上面的清楚呢。。。

avatar
s*n
8
据说美国的phd program有两种macroeconomics
一种是minnesota macro,一种是nonminnesota macro
我没读过,我不知道具体的.....
PS:我就在u of minnesota...
avatar
g*s
9
data_type& operator [](const key_type& k);

【在 c*****z 的大作中提到】
: M["hello"] 返回值事什么类型的啊
avatar
s*n
10
不过minnesota的macro确实很强
你翻一下历年的placement,macro每年都有去顶级校的
avatar
g*s
11
原来那个code费解就是因为A()按理是没有类型返回的,却做了右值。

【在 g*********s 的大作中提到】
: data_type& operator [](const key_type& k);
avatar
s*n
12
另外,小声说一下..MWG中的M就是minnesota phd毕业的..
avatar
t*t
13
kidding?
A() returns type A, of course.

【在 g*********s 的大作中提到】
: 原来那个code费解就是因为A()按理是没有类型返回的,却做了右值。
avatar
a*r
14
似乎 M 的专长是 Non Minnesota-macro, i.e. Minnesota micro, :)

【在 s*******n 的大作中提到】
: 另外,小声说一下..MWG中的M就是minnesota phd毕业的..
avatar
g*s
15
A or A&?
具体到这个例子,M["hello"]=A(); 展开的话是M先创建一个"hello"为key的节点,A()
创建一个临时匿名对象A,再通过赋值操作符函数,内容复制到M["hello"]里去?之后
临时匿名对象消失?
我印象中很多参考书都说constructor没有返回类型。刚才google了一下这样的说法不
少。
现在看来,精确的说法是constructor不能被程序员显式指定返回类型。

【在 t****t 的大作中提到】
: kidding?
: A() returns type A, of course.

avatar
s*n
16
恩,M是少数几个micro毕业生中出名的了。。
avatar
P*e
17
最后一句话,是语法啊,ctor本来就没有return type
A()不算临时变量了,因为就好象M["hello"]是一个variable了, 跟string s =
string("");是一样的

()

【在 g*********s 的大作中提到】
: A or A&?
: 具体到这个例子,M["hello"]=A(); 展开的话是M先创建一个"hello"为key的节点,A()
: 创建一个临时匿名对象A,再通过赋值操作符函数,内容复制到M["hello"]里去?之后
: 临时匿名对象消失?
: 我印象中很多参考书都说constructor没有返回类型。刚才google了一下这样的说法不
: 少。
: 现在看来,精确的说法是constructor不能被程序员显式指定返回类型。

avatar
z*e
18
Minnesota style: 1.start with data, find a puzzle or contradictory between
standard model and the data. 2. Modify the standard model. 3. calibrate the
model and simulate. 4. new model successfully solves/or fails to solve the
problem.
Minnesota is really strong in Macro. To my opinion, top 5. UM has another
advantage compared to many other top programs such as Chicago. Professors at
UM are also very pushy for their students. I received a reference letter
from Pat Kehoe a couple of years ago sayi
avatar
t*t
19
of course A() is a temp object.
more precisely, A() returns a temp object. objects returned from function (not reference to object) are all temporary.

【在 P********e 的大作中提到】
: 最后一句话,是语法啊,ctor本来就没有return type
: A()不算临时变量了,因为就好象M["hello"]是一个variable了, 跟string s =
: string("");是一样的
:
: ()

avatar
i*e
20
我听一个去FRB minneapolis访问过一年的老师说,明尼苏达另外一个好处是,他们的
宏观老师和FRB minneapolis联系很紧密,很多宏观的学生在里面做研究助手。夏天的
时候其他地方的宏观大佬有时会去FRB minneapolis,如果你上心、有像样的文章可以
present,就会得到一些大佬交流的机会,尤其是新古典的大佬。
avatar
t*t
21
你前面说的都对(指M["hello"]=A();的操作), 除了匿名对象这个说法不太准确, 因为C
++里用的名称是临时对象.
后面, constructor没有返回类型是对的, 但是A()返回类型是A(not A&)也是对的.
因为A()并不是"调用"constructor. constructor通常不能显式调用, 除了在
initializer list里以外. A()是一个表达式, 它的返回类型刚好是A, 实际上是
Explicit type conversion (functional notation).

()

【在 g*********s 的大作中提到】
: A or A&?
: 具体到这个例子,M["hello"]=A(); 展开的话是M先创建一个"hello"为key的节点,A()
: 创建一个临时匿名对象A,再通过赋值操作符函数,内容复制到M["hello"]里去?之后
: 临时匿名对象消失?
: 我印象中很多参考书都说constructor没有返回类型。刚才google了一下这样的说法不
: 少。
: 现在看来,精确的说法是constructor不能被程序员显式指定返回类型。

avatar
f*n
22
Macro ranking, UMN不是一直稳定在top5吗
avatar
c*a
23
Prescott是从umn刚走一年就拿了炸药奖了?

【在 i*******e 的大作中提到】
: 我听一个去FRB minneapolis访问过一年的老师说,明尼苏达另外一个好处是,他们的
: 宏观老师和FRB minneapolis联系很紧密,很多宏观的学生在里面做研究助手。夏天的
: 时候其他地方的宏观大佬有时会去FRB minneapolis,如果你上心、有像样的文章可以
: present,就会得到一些大佬交流的机会,尤其是新古典的大佬。

avatar
c*d
24
Minnesota is my dream school actually.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。