由买买提看人间百态

topics

全部话题 - 话题: std
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
y****n
发帖数: 15
1
来自主题: Programming版 - 请教一个关于std::function的问题
请大牛们帮忙看看这段代码,在编译的时候会有如下error message 请问如何能编译通
过啊?跪谢!
当然这只是个虚构的例子,主要是想在template存在的情况下,传递一个member
function的指针给另一个member function.
test1.cpp: In member function 'void Foo::testInt()':
test1.cpp:30:61: error: no matching function for call to 'Foo::processVector
(std::vector&, std::_Bind_helper std::_Placeholder<1>&>::type)'
processVector(arr, std::bind(&Foo::print, this, _1));
^
test1.c... 阅读全帖
c**********e
发帖数: 2007
2
来自主题: JobHunting版 - C++ Q41: std::sort (C4)
How do you use STL's std::sort algorithm to sort an array declared as int v[
1000]?
a) std::sort(v);
b) std::sort(v,v+1000);
c) std::sort((void*)v, 1000, sizeof(int), sortInt);
(assuming sortInt is defined properly)
d) std::sort((void*)v,(void*) &v+1000, sizeof(int));
e) std::sort(v.begin(),v.end());
j*****u
发帖数: 186
3
下面程序来自于essential C++ 3.6节,给定一个数组,输出比某个数小的所以元素。
main函数中用了back_inserter,按道理是不是应该include iterator头文件和
using std::back_inserter? 但是为什么把这两句注释掉程序也能跑呢?谢谢。
===================================================================
#include
#include
#include
#include
#include
//#include
using std::vector;
using std::cout;
using std::endl;
using std::less;
//using std::back_inserter;
template 阅读全帖
j*****u
发帖数: 186
4
下面程序来自于essential C++ 3.6节,给定一个数组,输出比某个数小的所以元素。
main函数中用了back_inserter,按道理是不是应该include iterator头文件和
using std::back_inserter? 但是为什么把这两句注释掉程序也能跑呢?谢谢。
===================================================================
#include
#include
#include
#include
#include
//#include
using std::vector;
using std::cout;
using std::endl;
using std::less;
//using std::back_inserter;
template 阅读全帖
d****l
发帖数: 51
5
来自主题: Programming版 - 请教一个关于std::function的问题
根据编译的错误信息,processVector()的第二个变量被定义为std::function >,而在调用时传入的是std::_Bind_helper const std::_Placeholder<1>&>::type),编译器无法确定这二者是同一类型,因此报
错。你可以定义一个std::function变量然后把bind赋值给它(implicit
cast)之后在调用processVector时传入这个变量,或者直接static_cast (the
following code uses static_cast and works fine on my machine with gcc-4.8.0):
...
void testint()
{
...
processVector(arr, static_cast>(std::bind(&Foo::
print, this, _1)));
}
...
另外,二楼建议的写... 阅读全帖
b***i
发帖数: 3043
6
我们有个类,叫Pole吧
std::vector PoleAccess::Load(...){
std::vector poles;
... 动态生成Pole对象,加入到vector里面
return poles;
}
然后,有另一个类,HPleManager,里面要这样做
std::vector* PoleManager::LoadHole(
return new std::vector(PoleAccess::Load(...));
}
1 这样的话,是不是一开始有一个vector在栈上,然后为了返回堆上的指针,把内容复
制到了堆上?
2 这个new std::vector(Pole)是move constructor还是copy?
3 但是为了把栈上的变量移动到堆上,还是得copy吧?当然,只是一个vector容器的信
息而已,真正vector内容都在堆上吧。而且,内容指向的Pole对象也都在堆上。
4 这个过程RVO负责直接优化到堆上吗?我问这个问题是因为我需要把PoleAcces... 阅读全帖
m******t
发帖数: 273
7
Yes, I have only mean and std. dev.
I only need to find shape, scale. If we can also find location, it will be
better.
I have a group of data mean and std. dev. It means that each data point in
the given set is a mean and std. dev., which are calculated from a truncated
gamma distribution.
Each point may have a different truncated gamma distribution, which has the
same truncated values.
They may have some relationship between any two data point (mean, std.dev.),
but, we do not know.
So, it makes... 阅读全帖
n******g
发帖数: 17225
8
来自主题: Military版 - 搞外国女人搞多了容易STD (转载)
【 以下文字转载自 Dreamer 讨论区 】
发信人: Dreamer (不要问我从哪里来), 信区: Dreamer
标 题: 搞外国女人搞多了容易STD
发信站: BBS 未名空间站 (Tue Jul 8 01:02:24 2014, 美东)
第一次是刚出国时候得的。国内从来没有什么系统的性教育,对STD更加是讳莫如深。
第一年住在学校的dorm,party很多,没注意安全措施。过了半年做了个检查,
chlamydia。吃了一礼拜的药就好了。复查一切正常。自打那以后,每次凡是换了新的
性伙伴都会去做检查,也很注意安全措施。
最近毕业工作,一次晚上和白女在酒吧ONS,身边没套子,就问她:are you clean? 白
女回答yes。也没多想就一起去了厕所。过了一个多礼拜,发觉有点异样。去医院做了
个STD全面检查,结果又是chlamydia。还多了个 Herpes type i. 我当时看到结果吓的
半死,因为herpes是无法治愈的。后来医生解释 herpes type i没有关系,是cold
sore virus 大部分人都有。而 herpes type ii是非常恐怖的... 阅读全帖
f*******6
发帖数: 665
9
来自主题: NextGeneration版 - Stort-term disability (STD )缴税问题
policy上写的是 you will be taxed on the STD premium which will allow you to
receive the STD benefit tax free.
我问了人事她也不大明白,公司给交premium, 我听说STD的钱是不用交税的,是不是这
样?
如果休产假,STD的是不是应该可以根据真正生的时间调整开始日期,一般什么时候开
始休好?
f********f
发帖数: 290
10
我一般就是一个
using namespace std;就完事了
看很多人习惯于用一个,加一个:using std::vector; using std::cin;....
难不成效率高??
thanks a lot
g****r
发帖数: 35
11
假定
C
是预定义的 template class
用 list 保存一组 C 指针
std::list*> myList;
如何设计一个 template 函数,在其中采用 iterator 访问 myList 的成员?
template
void f(T& t)
{
std::list*> pos = myList.begin();
std::list*>::iterator pos; // This line give me
error
while (pos != myList.end())
{
(*pos).... blah blah
++pos;
}
}
编译器对 iterator 的定义行报错,如下:
error: parse error before `;' token
替换为
std::_List_iterator*> pos;
在 iMac 上
p***o
发帖数: 1252
12
来自主题: Programming版 - std::lower_bound 名不副实啊
std::lower_bound returns the lowest position to insert the element without
violating the ordering. std::upper_bound returns the highest position.
If elements with the same value are not presented, std::lower_bound and
std::upper_bound return the same position. Otherwise, lower_bound returns
the iterator to the first such element and upper_bound returns the iterator
after the last such element.

)
l*****0
发帖数: 299
13
原始数据点yi的std err会影响fitted curve的confidence bound吗?
每个原始数据点yi的std err SEi在做regression y(x) = fitResult(x) + ep(x) 时候
会转化成weights: wi = 1/Ni/SEi^2。

请问这些原始数据点的std errs会影响fitted curve的confidence bound吗?
知觉上好像是原始数据点的std errs越大,fitted curve的confidence band越宽,不
知是否正确?
谢谢!
l*****0
发帖数: 299
14
原始数据点yi的std err会影响fitted curve的confidence bound吗?
每个原始数据点yi的std err SEi在做regression y(x) = f(x) + ep(x) 时候会转化成
weights: wi = 1/Ni/SEi^2。

请问这些原始数据点的std errs会影响fitted curve的confidence bound吗?
知觉上好像是原始数据点的std errs越大,fitted curve的confidence band越宽,不
知是否正确?
谢谢!
U*****S
发帖数: 3098
15
来自主题: WorldNews版 - 老美STD还是很凶的 (转载)
【 以下文字转载自 Piebridge 讨论区 】
发信人: zhengshi (zhengshi), 信区: Piebridge
标 题: 老美STD还是很凶的
发信站: BBS 未名空间站 (Mon Mar 1 14:17:47 2010, 美东)
老美STD还是很凶的。WF前一定要搞清那个发可的性史,最重要的是上床前一定要他作
STD检查确认干净才行。比如HPV (CAUSE宮頸癌):
According to a 1997 American Journal of Medicine article, nearly 3 in 4
Americans between the ages of 15 and 49 have been infected with genital HPV
at some point in their life.
没事别WF,WF必带套!
O******i
发帖数: 269
16
来自主题: JobHunting版 - std::list如何检测环?
Please implement the loop detection for std::list, like hasLoop(std::list
alist)
如果是普通链表找环,可以用两个指针,一快一慢。能套用到这题么?具体code如何写?
bool hasLoop(std::list alist)
{
blablabla
}
m******t
发帖数: 273
17
【 以下文字转载自 Statistics 讨论区 】
发信人: myregmit (myregmit), 信区: Statistics
标 题: find distribution paramters only by data mean and std. dev.
发信站: BBS 未名空间站 (Mon Mar 17 17:14:15 2014, 美东)
I need to estimate a truncated gamma distribution paramters (shape , scale).
But, I only know the data mean and std. dev. I do not know the dat set.
Given the mean and std. dev. of a data set from a trucnated gamma
distribution, how to find shape and scale of the distribution parameters ?
I know MLE may be sueful for ... 阅读全帖
T******7
发帖数: 1419
18
effective modern cpp有人看了没,感觉如何?
面试用里面的概念考candidates会不会被骂娘
打算问问std::move 和 std::forward.
j****i
发帖数: 305
19
来自主题: Programming版 - macro and std:: function name clashing
I'm using clapack where some macros like min, max, abs etc are defined. When
I include the f2c.h and clapack.h headers the gcc compiler complains that
the std::numeric_limits::max() in my own code does not have enough
number of arguments for the macro "max". The compiler uses the "max" defined
in the f2c.h instead of using the one in std, even though I specified the
namespace and class numeric_limits when I call the max().
I "fixed" this problem by removing all the calls to std::numeric_
b*****n
发帖数: 2324
20
来自主题: Programming版 - 这该不该算std::map的一个bug
std::cout << "3.5 map1.size(): " << map1.size() << endl;
std::cout << "4 map1[key1].size(): " << map1[key1].size() <<
endl;
std::cout << "4.5 map1.size(): " << map1.size() << endl;
output:
3.5 map1.size(): 0
4 map1[key1].size(): 0
4.5 map1.size(): 1
z*******h
发帖数: 346
21
我不是C++大牛,不过最近正好也碰到了同样的问题。
我觉得 new std::vector(PoleAccess::Load(...)) 是copy constructor复制
了一个object, 不是move.
你问什么不这样定义呢?
std::vector PoleManager::LoadHole(
std::vector poles = PoleAccess::Load(...);
return poles;
}
这样应该是用C++11的move semantics
你可以参照一下
https://stackoverflow.com/questions/15704565/efficient-way-to-return-a-
stdvector-in-c
我们公司的C++大牛们写的code都是return vector的,而不是pointer to vector.
y**b
发帖数: 10166
22
说的对,pointer to vector,那还要vector干嘛;
容器就是设计用来避免数组和指针这类不强健的用法,
还去new个容器。


: 我不是C 大牛,不过最近正好也碰到了同样的问题。

: 我觉得 new std::vector(PoleAccess::Load(...)) 是copy constructor
复制

: 了一个object, 不是move.

: 你问什么不这样定义呢?

: std::vector PoleManager::LoadHole(

: std::vector poles = PoleAccess::Load(...);

: return poles;

: }

: 这样应该是用C 11的move semantics

: 你可以参照一下

y**b
发帖数: 10166
23
来自主题: Programming版 - std::size_t的麻烦
一是写起来麻烦,不像int那么简便,当然现在很多地方可以
用auto替换,但仍然很多地方不行;
二是size_t类型的递减,或者两个size_t之间的减法更是恶梦。
要求保证a-b>=0,这简直是荒谬,模拟实际问题时根本无法做到。
至于递减,C++ primer第五版为了保证永远>0将变量预先加一的
做法既不具备普遍性,也容易出错。
对a-b这种情况,我只好(int)a - (int)b。当年写出这种恶句:
for (std::size_t i = std::max((int)ip - (int)maxGrid, 0); i < std::min(ip +
maxGrid + 1, gridNx); ++i)
难道就没有什么好办法?还有C++为什么不对a-b这种情况给予编译警告?
还有一个更严重问题就是,C++不能像Fortran那样运行时检测数组
或向量越界,这点在科学计算里面调试程序也是个恶梦。vector.at()
虽然可以检测越界,但是远没有调试模式方便。
m******t
发帖数: 273
24
【 以下文字转载自 Statistics 讨论区 】
发信人: myregmit (myregmit), 信区: Statistics
标 题: find distribution paramters only by data mean and std. dev.
发信站: BBS 未名空间站 (Mon Mar 17 17:14:15 2014, 美东)
I need to estimate a truncated gamma distribution paramters (shape , scale).
But, I only know the data mean and std. dev. I do not know the dat set.
Given the mean and std. dev. of a data set from a trucnated gamma
distribution, how to find shape and scale of the distribution parameters ?
I know MLE may be sueful for ... 阅读全帖
m******t
发帖数: 273
25
【 以下文字转载自 Statistics 讨论区 】
发信人: myregmit (myregmit), 信区: Statistics
标 题: find distribution paramters only by data mean and std. dev.
发信站: BBS 未名空间站 (Mon Mar 17 17:14:15 2014, 美东)
I need to estimate a truncated gamma distribution paramters (shape , scale).
But, I only know the data mean and std. dev. I do not know the dat set.
Given the mean and std. dev. of a data set from a trucnated gamma
distribution, how to find shape and scale of the distribution parameters ?
I know MLE may be sueful for ... 阅读全帖
o******l
发帖数: 828
26
把它国人当小白鼠做STD实验。这帮人是没什么道德感的。姓肖的就是个代理,主子们
当然要支持。以下是CNN首页关于用Guatemalans人做STD实验链接。
http://www.cnn.com/2010/WORLD/americas/10/01/us.guatemala.apology/index.html?hpt=T2

发帖数: 1
27
O8 的又一项伟大成就: STD cases hit record high in the U.S.
https://www.cbsnews.com/news/std-cases-hit-record-high-in-us/
p********g
发帖数: 8855
28
来自主题: Classified版 - [求购]adobe acrobat x std/pro @166/276
我想要的物品:
adobe acrobate x std/pro @166/276
单张面值:
uno
可接受的价格(必须明码标价!):
std 166, pro 276
物品新旧要求:
new, 盒子完整
邮寄方式要求:
ML
买卖双方谁承担邮寄损失(Required if not code only):
付款方式说明:
其他补充说明:
广告的有效期:
物品来源:
我的联系方式:
二手交易风险自负!请自行验证是否合法和一手卡!:
p********g
发帖数: 8855
29
来自主题: FleaMarket版 - [求购]adobe acrobat x std/pro @166/276
我想要的物品:
adobe acrobate x std/pro @166/276
单张面值:
uno
可接受的价格(必须明码标价!):
std 166, pro 276
物品新旧要求:
new, 盒子完整
邮寄方式要求:
ML
买卖双方谁承担邮寄损失(Required if not code only):
付款方式说明:
其他补充说明:
广告的有效期:
物品来源:
我的联系方式:
二手交易风险自负!请自行验证是否合法和一手卡!:
l*******y
发帖数: 901
30
来自主题: FleaMarket版 - [出售]xbox one 5绿(std)+1黑(day one)
二手交易风险自负!请自行验证是否合法和一手卡!:
我想卖的物品:
xbox one 5绿(std)+1黑(day one)
单张面值:
500
可接受价格(必须明码标价!):
560 for std, 610 for day one
物品新旧要求:
new in hand
邮寄方式要求:
your label
买卖双方谁承担邮寄损失(Required if not code only):
default
付款方式说明:
boa/billpay
其他补充说明:
广告的有效期:
till gone
物品来源(Required for All Cards!):
walmart,target
我的联系方式:
bbs mail.
Warranty期限:
能否证明是合法的一手卡?(Required for All Cards!):
y
state and zip:
WA
H****s
发帖数: 247
31
来自主题: JobHunting版 - std::list如何检测环?
std::list不能有loop而且std::list是doubly linked list, how could a doubly
linked list contains a cycle if the begin() is not equal to end()?
n*******2
发帖数: 89
32
来自主题: JobHunting版 - 反pip 利器之STD
STD = short term disability
因为工作压力等引起的mental illness 楼主所在公司可以最多申请45天STD , 对于找
工作来说很宝贵。 开证明要找psychiatrist。 敬供参考
S**P
发帖数: 1194
33
来自主题: NextGeneration版 - Stort-term disability (STD )缴税问题
我不清楚STD要不要缴税,但是我STD阶段的工资公司没有withhold federal tax倒是真
y**y
发帖数: 132
34
来自主题: NextGeneration版 - 麻烦的STD一问
I have the same problem with my STD this time. It has been over 40 days, I
did not get a penny and have to send check to HR each payday to cover my
health insurance.
my STD insurance company is CIGNA, my case manager said she faxed 3 requests
for medical records already, when I call my OB office they said they did
not get any.
the thing I can not understand is: I had give disclosure authorization,
CIGNA should not have any problem getting any info from my Dr. If she did
not get response over 40
x*******l
发帖数: 542
35
来自主题: Stock版 - 大夫帮忙看看这只股票--STD
哪天std要是彪了,楼主大悦,众人不解,楼主大喝,I have std...

a
J**S
发帖数: 25790
36
来自主题: Stock版 - 今天小捞一把STD和NOK
希望没有捞错。
上周五,我还有3000股 STD,第二感觉情况会不妙,$12.65抛掉了,今天捞回来了3000
股,就不遗
憾了。希望STD给我挺住。
s*****r
发帖数: 1745
37
来自主题: Stock版 - 上次买STD那个亏废了吗
STD is easily to be cured and STD will be quickly recovered.
y*****p
发帖数: 733
38
来自主题: TAX版 - is STD tax-free?
I am in MA. I received STD payment last year.
My W2 box# 13 marks "3rd party sick pay".
My employer has paid the premiums in total.
Do I need to pay any federal or state tax on STD payment?
l*******g
发帖数: 4894
39
☆─────────────────────────────────────☆
Kiroro (山顶冻人) 于 (Mon Mar 23 01:28:17 2009) 提到:
在guitar center试的,觉得Squier手感不比Fender差多少阿,不过音色是差了点
但价格却是Fender的1/2还要少。。难道就上这个Squier Std Strat了?$199.
以前是弹民谣的,想转电吉他。对加州旅馆1976版solo比较痴迷。。
☆─────────────────────────────────────☆
Andy6431 (Andy6431) 于 (Mon Mar 23 11:47:47 2009) 提到:
好好挑挑,说不定真能挑把比的上standard 的squire
吉他的音色受很多影响,木头,结构,pickup
到后面是越来越贵,边际成本直线上升。
所以好吉他可能比一般的吉他就好那么一点,但是价格却是贵好几倍
☆─────────────────────────────────────☆
louiswang (潜心求学求知求职) 于 (Mo
z******i
发帖数: 721
40
STD: sex transmitted diseases
google HPV and HIV.
she should do STD screening especially when the guy was a white trash...
z******i
发帖数: 721
41
来自主题: Piebridge版 - 老美STD还是很凶的
老美STD还是很凶的。WF前一定要搞清那个发可的性史,最重要的是上床前一定要他作
STD检查确认干净才行。比如HPV (CAUSE宮頸癌):
According to a 1997 American Journal of Medicine article, nearly 3 in 4
Americans between the ages of 15 and 49 have been infected with genital HPV
at some point in their life.
没事别WF,WF必带套!
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)