Redian新闻
>
不同比例的幅面如何比较视角?
avatar
不同比例的幅面如何比较视角?# PhotoGear - 摄影器材
p*n
1
The return type of container.size() is size_t. If used as such, however, it
may complicate codes sometimes. See the following example:
size_t sz = container.size();
for(size_t i = 0; i < sz -1; i++){
..... // do something
}
The empty container has to be handled in a different way, perhaps tested
before entering the for loop. Now, if we insist using size_t and empty
container is not a problem, we could still encounter the following problem:
size_t sz = contianer.size();
while( sz > 0 ){
...... // the expression may contain --sz or sz -= 2;
}
Again, the fact that size_t is an unsigned type is a pain in the ass.
I noticed many sample codes posted here suggesting the following usage
int sz = container.size();
Associated is the possibility of overflowing, since size_t is implementation
dependent and is likely larger than int. Of course we could use long long,
but it looks weird.
I wonder what is the best way to handle this problem?
avatar
p*e
2
6x6上80mm的镜头 应该相当于135或者645上多少毫米的镜头呢?
如果都是以对角线作为计算视角的标准 似乎不够有说服力 尤其在比较宽幅和6x6两个
极端的时候
avatar
p*p
3
你有iterator
你有for each

it

【在 p****n 的大作中提到】
: The return type of container.size() is size_t. If used as such, however, it
: may complicate codes sometimes. See the following example:
: size_t sz = container.size();
: for(size_t i = 0; i < sz -1; i++){
: ..... // do something
: }
: The empty container has to be handled in a different way, perhaps tested
: before entering the for loop. Now, if we insist using size_t and empty
: container is not a problem, we could still encounter the following problem:
: size_t sz = contianer.size();

avatar
h*y
4
别联系在一起
不同画面比例是不同的思考方式
不同画副大小也是啊 ...

【在 p********e 的大作中提到】
: 6x6上80mm的镜头 应该相当于135或者645上多少毫米的镜头呢?
: 如果都是以对角线作为计算视角的标准 似乎不够有说服力 尤其在比较宽幅和6x6两个
: 极端的时候

avatar
d*x
5
so i would say you did not use your brain at all...
can you use "i + 1 < sz" instead?

it
implementation
,

【在 p****n 的大作中提到】
: The return type of container.size() is size_t. If used as such, however, it
: may complicate codes sometimes. See the following example:
: size_t sz = container.size();
: for(size_t i = 0; i < sz -1; i++){
: ..... // do something
: }
: The empty container has to be handled in a different way, perhaps tested
: before entering the for loop. Now, if we insist using size_t and empty
: container is not a problem, we could still encounter the following problem:
: size_t sz = contianer.size();

avatar
j*c
6
按长边来算比例
avatar
S*I
7
To iterate elements in a STL container, you should use iterator instead of
index. To check whether a container is empty or not, you should use
container.empty() instead of container.size() > 0.

it

【在 p****n 的大作中提到】
: The return type of container.size() is size_t. If used as such, however, it
: may complicate codes sometimes. See the following example:
: size_t sz = container.size();
: for(size_t i = 0; i < sz -1; i++){
: ..... // do something
: }
: The empty container has to be handled in a different way, perhaps tested
: before entering the for loop. Now, if we insist using size_t and empty
: container is not a problem, we could still encounter the following problem:
: size_t sz = contianer.size();

avatar
p*e
8
6x6和617咋办

按长边来算比例

【在 j****c 的大作中提到】
: 按长边来算比例
avatar
d*x
9
seriously, who will use iterator for vector<> ?

【在 S**I 的大作中提到】
: To iterate elements in a STL container, you should use iterator instead of
: index. To check whether a container is empty or not, you should use
: container.empty() instead of container.size() > 0.
:
: it

avatar
s*s
10
没有对应视角,要分别算横边纵边。

【在 p********e 的大作中提到】
: 6x6和617咋办
:
: 按长边来算比例

avatar
p*n
11
the 2nd example, plz

【在 d**********x 的大作中提到】
: so i would say you did not use your brain at all...
: can you use "i + 1 < sz" instead?
:
: it
: implementation
: ,

avatar
j*c
12
镜头视野都是圆的,只是成像屏被裁成了方的

【在 p********e 的大作中提到】
: 6x6和617咋办
:
: 按长边来算比例

avatar
S*I
13
First, LZ didn't say the container is a vector type; second, if using
iterator, the silly mistake of using i < sz - 1 won't happen.

【在 d**********x 的大作中提到】
: seriously, who will use iterator for vector<> ?
avatar
p*e
14
有些佳能镜头视野不是的 有的已经按照2/3裁剪过了 包括hood

镜头视野都是圆的,只是成像屏被裁成了方的

【在 j****c 的大作中提到】
: 镜头视野都是圆的,只是成像屏被裁成了方的
avatar
d*x
15
use an index i instead of directly changing sz
then it's the same as the first one.

【在 p****n 的大作中提到】
: the 2nd example, plz
avatar
j*c
16
你可以做个系统的计算,写篇wiki吧,呵呵

【在 p********e 的大作中提到】
: 有些佳能镜头视野不是的 有的已经按照2/3裁剪过了 包括hood
:
: 镜头视野都是圆的,只是成像屏被裁成了方的

avatar
p*n
17
what if I have something like vector used, e.g. to generate all
permutations from a given set (given by a vector). In this case, index
is easier to use.

【在 p*****p 的大作中提到】
: 你有iterator
: 你有for each
:
: it

avatar
c*y
18
成像圈当然是圆的啊

【在 p********e 的大作中提到】
: 有些佳能镜头视野不是的 有的已经按照2/3裁剪过了 包括hood
:
: 镜头视野都是圆的,只是成像屏被裁成了方的

avatar
p*n
19
thx
i think to make minimum modification, i could write something like
while(true){
...//before --sz, add
if(sz<=1) break;
...//before sz -= 2, add
if(sz<=2) break;
....
}

【在 d**********x 的大作中提到】
: use an index i instead of directly changing sz
: then it's the same as the first one.

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