L*s
2 楼
新买了英格兰足球队球鞋, 怎样把它加在形象上。
Y*e
3 楼
暖色调容易给人温暖奔放被接受的感觉;冷色调则相反。
而我最推崇湖绿湖蓝。
原因引如下摘录:
“在艺术观点上,印象主义画家反对当时占正统地位的古典学院派,反对日益落入俗套
、矫揉造作的浪漫主义绘画(Romanticism),而是在C.柯罗、巴比松画派和G.库尔贝等
人的写实画风的推动下,吸收荷兰、英国、西班牙、日本、中国等国家绘画的营养,同
时受现代科学,尤其是光学的启发,认为一切色彩皆产生于光,于是他们依据光谱赤橙
黄绿青蓝紫七色来调配颜色。由于光是瞬息万变的,他们认为只有捕捉瞬息间光的照耀
才能揭示自然界的奥妙。因此在绘画中注重对外光的研究和表现,主张到户外去,在阳
光下依据眼睛的观察和现场的直感作画,表现物象在光的照射下,色彩的微妙变化。由
此印象主义绘画在阴影的处理上,一反传统绘画的黑色而改用有亮度的青、紫等色。印
象派绘画用点取代了传统绘画简单的线与面,从而达到传统绘画所无法达到的对光的描
绘。具体的说,当我们从近处观察印象派绘画作品时,我们看到的是许多不同的色彩凌
乱的点,但是当我们从远处观察他们时,这些点就会像七色光一样汇聚起来,给人光的
感觉,达到异想不到的效果。”
而我最推崇湖绿湖蓝。
原因引如下摘录:
“在艺术观点上,印象主义画家反对当时占正统地位的古典学院派,反对日益落入俗套
、矫揉造作的浪漫主义绘画(Romanticism),而是在C.柯罗、巴比松画派和G.库尔贝等
人的写实画风的推动下,吸收荷兰、英国、西班牙、日本、中国等国家绘画的营养,同
时受现代科学,尤其是光学的启发,认为一切色彩皆产生于光,于是他们依据光谱赤橙
黄绿青蓝紫七色来调配颜色。由于光是瞬息万变的,他们认为只有捕捉瞬息间光的照耀
才能揭示自然界的奥妙。因此在绘画中注重对外光的研究和表现,主张到户外去,在阳
光下依据眼睛的观察和现场的直感作画,表现物象在光的照射下,色彩的微妙变化。由
此印象主义绘画在阴影的处理上,一反传统绘画的黑色而改用有亮度的青、紫等色。印
象派绘画用点取代了传统绘画简单的线与面,从而达到传统绘画所无法达到的对光的描
绘。具体的说,当我们从近处观察印象派绘画作品时,我们看到的是许多不同的色彩凌
乱的点,但是当我们从远处观察他们时,这些点就会像七色光一样汇聚起来,给人光的
感觉,达到异想不到的效果。”
h*g
4 楼
【 以下文字转载自 JobHunting 讨论区 】
发信人: huasing (Menlo Park), 信区: JobHunting
标 题: C++里get array size的问题
发信站: BBS 未名空间站 (Wed Jul 21 13:45:52 2010, 美东)
C++里是不是现在没有现成的get array size/length的function??
如果没有的话,我在网上看到了一个code
#include
template char (&array(T(&)[N]))[N];
#define length(a) (sizeof a / sizeof a[0])
int main()
{
int a[10];
std::cout << sizeof array(a) << '\n';
std::cout << length(a) << '\n';
}
请问这个code对所有的data type都work吗? 我试试了,好象是可以的。中间有什么错
误吗?
发信人: huasing (Menlo Park), 信区: JobHunting
标 题: C++里get array size的问题
发信站: BBS 未名空间站 (Wed Jul 21 13:45:52 2010, 美东)
C++里是不是现在没有现成的get array size/length的function??
如果没有的话,我在网上看到了一个code
#include
template
#define length(a) (sizeof a / sizeof a[0])
int main()
{
int a[10];
std::cout << sizeof array(a) << '\n';
std::cout << length(a) << '\n';
}
请问这个code对所有的data type都work吗? 我试试了,好象是可以的。中间有什么错
误吗?
q*9
5 楼
你是求职啊还是招聘呢
d*p
7 楼
Interesting. Should be working in theory.
However, it is just a syntax sugar and I doubt if all compilers support it
well since it makes the parsing complicate.
However, it is just a syntax sugar and I doubt if all compilers support it
well since it makes the parsing complicate.
L*s
8 楼
多谢。
看来我老了,不中用了。
看来我老了,不中用了。
p*o
9 楼
Most likely they won't work under the situation LZ needs them to work,
e.g. after passing the array to a function ...
BTW, I don't see the advantage of the template approach compared to
the sizeof/sizeof approach. Is it more robust?
【在 d****p 的大作中提到】
: Interesting. Should be working in theory.
: However, it is just a syntax sugar and I doubt if all compilers support it
: well since it makes the parsing complicate.
e.g. after passing the array to a function ...
BTW, I don't see the advantage of the template approach compared to
the sizeof/sizeof approach. Is it more robust?
【在 d****p 的大作中提到】
: Interesting. Should be working in theory.
: However, it is just a syntax sugar and I doubt if all compilers support it
: well since it makes the parsing complicate.
E*V
10 楼
d*p
11 楼
Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
Lz's code however technically is right - declare a function which takes in a
pointer to an array whose length is known at compile time and returns a
pointer to an array whose length is also known.
A pointer to an array is slightly different with an array from the
perspective of compiler though the sizeof operator will produce the same
result for them.
Basically you cannot return an array from a function but you can return a
p
Lz's code however technically is right - declare a function which takes in a
pointer to an array whose length is known at compile time and returns a
pointer to an array whose length is also known.
A pointer to an array is slightly different with an array from the
perspective of compiler though the sizeof operator will produce the same
result for them.
Basically you cannot return an array from a function but you can return a
p
d*p
12 楼
Took another look.
The error message from Solaris CC is against
template char (&array(T(&)[N]))[N];
The last [N] was treated a subscript operator and N was expected to be
constant.
If typedef template is supported in C++, we can get this around by
template
typedef T(&T_N_array)[N];
template T_N_array array(T(&)[N]);
a
or
【在 d****p 的大作中提到】
: Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
: Lz's code however technically is right - declare a function which takes in a
: pointer to an array whose length is known at compile time and returns a
: pointer to an array whose length is also known.
: A pointer to an array is slightly different with an array from the
: perspective of compiler though the sizeof operator will produce the same
: result for them.
: Basically you cannot return an array from a function but you can return a
: p
The error message from Solaris CC is against
template
The last [N] was treated a subscript operator and N was expected to be
constant.
If typedef template is supported in C++, we can get this around by
template
typedef T(&T_N_array)[N];
template
a
or
【在 d****p 的大作中提到】
: Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
: Lz's code however technically is right - declare a function which takes in a
: pointer to an array whose length is known at compile time and returns a
: pointer to an array whose length is also known.
: A pointer to an array is slightly different with an array from the
: perspective of compiler though the sizeof operator will produce the same
: result for them.
: Basically you cannot return an array from a function but you can return a
: p
p*o
13 楼
Beginners usually write code like follows ;)
void func(int array[N])
{
int size = sizeof(array)/sizeof(array[0]);
...
}
a
or
【在 d****p 的大作中提到】
: Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
: Lz's code however technically is right - declare a function which takes in a
: pointer to an array whose length is known at compile time and returns a
: pointer to an array whose length is also known.
: A pointer to an array is slightly different with an array from the
: perspective of compiler though the sizeof operator will produce the same
: result for them.
: Basically you cannot return an array from a function but you can return a
: p
void func(int array[N])
{
int size = sizeof(array)/sizeof(array[0]);
...
}
a
or
【在 d****p 的大作中提到】
: Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
: Lz's code however technically is right - declare a function which takes in a
: pointer to an array whose length is known at compile time and returns a
: pointer to an array whose length is also known.
: A pointer to an array is slightly different with an array from the
: perspective of compiler though the sizeof operator will produce the same
: result for them.
: Basically you cannot return an array from a function but you can return a
: p
m*s
14 楼
a
The template function takes in a "reference" to an array, instead of a "
pointer"
to an array and so is the return value.
The advantage for the template version is that it enforces the compile time
type
check that the passed in parameter be an array of T, not a pointer to T,
which
is better than the second version that accepts a pointer to T (or any object
that
overloads [], like a vector
or
【在 d****p 的大作中提到】
: Yes, I agree with you that sizeof(array)/sizeof(array_elem) is better.
: Lz's code however technically is right - declare a function which takes in a
: pointer to an array whose length is known at compile time and returns a
: pointer to an array whose length is also known.
: A pointer to an array is slightly different with an array from the
: perspective of compiler though the sizeof operator will produce the same
: result for them.
: Basically you cannot return an array from a function but you can return a
: p
相关阅读
各个语言在paradigms上的对比湾区码工的职称给王垠同学的一点看法 (转载)手机app娱乐可以,干活是不行的。怎样设计动态显示关于barrier to entry参加scala days的唯一感受从刀塔传奇事件谈谈如何保护/剽窃app代码interface是oo feature吗clojure这符号花花绿绿的 也是醉了仔细学了hs 打算弃clj了现在谈paradigm过时了吐槽Office365web问题就两个vert.x v3的sneaky-peak用golang实现了map,大牛给看看?用缩进的语言是不是最zbgolang的问题是channel, goroutine里面magic太多,有人听说过AirWatch吗?什么是MDM和MAM?正则表达式里括号的转义好乱