|
D*******a 发帖数: 3688 | 2 perhaps vector is ok, but map...
,
问题 |
|
|
r*******y 发帖数: 1081 | 4 it is initialization. try this
static vector v;
cout <
the output is 0, which means v is initialized with empty string. |
|
S**I 发帖数: 15689 | 5 initialized as usual:
vector A::s(10, ""); |
|
m*********g 发帖数: 646 | 6 what if I want this static vector to store "ABC" "DEF" "GHI" ? |
|
t****t 发帖数: 6806 | 7 now that's the correct way to ask question. initialize? with what? you have
to be specific. initialize with empty vector is initialize too, and it doesn
't matter whether you have static object or not.
experienced ppl may have guessed what you need, but most ppl won't.
now here is the answer. there is no decent way to do this in c++03. you may
define const char* array and initialize with it, but you add extra objects.
it's ugly and easy to make mistakes.
c++0x added std::initializer_list<>, whic... 阅读全帖 |
|
m*********g 发帖数: 646 | 8 I really don't want to argue with ppl on BBS. Ok, whatever you say.
I just assume ppl are experienced here, and know an empty static vector is
useless except showing some correct "book knowledge".
But thanks for your input. I know the way to use a static array but still it
helps, especially abt the c++OX.
have
doesn
may
. |
|
h********n 发帖数: 1671 | 9 别人需要看的是声明,而不是定义。到.cpp里看定义才知道它是什么,这样更confuse
别人。
进入main()以后进行实质的初始化,可以保证这时所有变量都已经处在valid状态。你
这个例子用的都是库类型,还问题不大。如果某一天你换成了自己的string类,或者改
用自己的allocator,那这种静态初始化的用法就是一个定时炸弹,不知什么地方就有
可能会引用到一个还没有初始化的变量。
原则上static变量的初始状态都应该尽可能简单。把复杂的参数写进构造函数参数列表
,与用一个函数来初始化没有区别,因为构造函数也是一个函数,只是语法不同。
前面的几个答案里,初始化为empty的那个才是最好的design,有经验的人都会这样写
。其他几个答案不过是为了满足你这个奇怪的用法而凑出来的。
另一方面,如果你不打算进行动态修改的话,为什么要用vector?这时用char
*[]是最合理的。如果你打算在程序中进行动态修改的话,动态初始化自然也很正常。 |
|
|
r*******y 发帖数: 1081 | 11 it is initialization. try this
static vector v;
cout <
the output is 0, which means v is initialized with empty string. |
|
S**I 发帖数: 15689 | 12 initialized as usual:
vector A::s(10, ""); |
|
m*********g 发帖数: 646 | 13 what if I want this static vector to store "ABC" "DEF" "GHI" ? |
|
t****t 发帖数: 6806 | 14 now that's the correct way to ask question. initialize? with what? you have
to be specific. initialize with empty vector is initialize too, and it doesn
't matter whether you have static object or not.
experienced ppl may have guessed what you need, but most ppl won't.
now here is the answer. there is no decent way to do this in c++03. you may
define const char* array and initialize with it, but you add extra objects.
it's ugly and easy to make mistakes.
c++0x added std::initializer_list<>, whic... 阅读全帖 |
|
m*********g 发帖数: 646 | 15 I really don't want to argue with ppl on BBS. Ok, whatever you say.
I just assume ppl are experienced here, and know an empty static vector is
useless except showing some correct "book knowledge".
But thanks for your input. I know the way to use a static array but still it
helps, especially abt the c++OX.
have
doesn
may
. |
|
h********n 发帖数: 1671 | 16 别人需要看的是声明,而不是定义。到.cpp里看定义才知道它是什么,这样更confuse
别人。
进入main()以后进行实质的初始化,可以保证这时所有变量都已经处在valid状态。你
这个例子用的都是库类型,还问题不大。如果某一天你换成了自己的string类,或者改
用自己的allocator,那这种静态初始化的用法就是一个定时炸弹,不知什么地方就有
可能会引用到一个还没有初始化的变量。
原则上static变量的初始状态都应该尽可能简单。把复杂的参数写进构造函数参数列表
,与用一个函数来初始化没有区别,因为构造函数也是一个函数,只是语法不同。
前面的几个答案里,初始化为empty的那个才是最好的design,有经验的人都会这样写
。其他几个答案不过是为了满足你这个奇怪的用法而凑出来的。
另一方面,如果你不打算进行动态修改的话,为什么要用vector?这时用char
*[]是最合理的。如果你打算在程序中进行动态修改的话,动态初始化自然也很正常。 |
|
s****y 发帖数: 2052 | 17 为啥公司里的code都很少见用vector, stl之类的,
会降低performance很多吗?如果都是图像处理的项目 |
|
c**********e 发帖数: 2007 | 18 I tested some simple stuff.
array costs much less time than vector. STL is not free -- in terms of time/
speed. |
|
y**b 发帖数: 10166 | 19 最近发现MPI并行程序操作HDF5格式大文件时,使用array简直是恶梦。
一是分配和释放同一块内存可能由不同函数完成,程序员负担极重。
二是各个进程(比如发送者和接收者)必须极其明确自己是否分配或释放了某块内存,
点对点通讯与collective通讯混合使用时候,极易出错,而且不好调试。
改成vector以后轻松一大截。 |
|
H****r 发帖数: 2801 | 20 无聊乱逛惊见snowdy 大侠!
vector, stl::containers 一般都是default分配到heap 吧,静态array好像是stack所
以会快不少,个人理解哈 @@ |
|
b***i 发帖数: 3043 | 21 but Children is not A, it's vector |
|
j*****g 发帖数: 16 | 22 简单测试一下楼主的class, 发现这句不能compile:
this->children->parent = a;
main.cpp: In constructor ‘A::A(A*, int)’:
main.cpp:25:
error: base operand of ‘->’ has non-pointer type ‘std::vector
allocator >’
这是为什么呢?多谢! |
|
t****t 发帖数: 6806 | 23 that is most probably copied from effective STL or some other book to "
really" release the vector memory. but it's actually not needed. |
|
w***g 发帖数: 5958 | 24 in terms of practical problem solving, I would say SVM is better.
In theory, the idea behind boosting, i.e. weak learner vs strong
learner, is a fundamental advancement in machine learning theory,
probably of philosophical importance. SVM itself is more technical,
but the theory that remotely backs SVM, i.e. VC theory, is even
more fundamental and more important than boosting. However,
the trivial version of SVM, i.e. linear SVM, has gained so much
attention lately that people view SVM more of... 阅读全帖 |
|
H******u 发帖数: 332 | 25 为啥assume编译器会为你优化哪?
当然vector定义了rhv的copy constructor,但是用一下move不好吗?
现在我老写c++代码都不敢用raw pointer,
Bird*> |
|
h**********c 发帖数: 4120 | 26 std::vector 只放class ojects吧,还是和java 混了,
不能放primitive type |
|
L****8 发帖数: 3938 | 27 std::vector啥都能放 不过不要放bool |
|
b***i 发帖数: 3043 | 28 我们是要放unique_ptr的,但是即使这样,有的时候有些函数需要返回裸指针的数组,
就要vector这样的。 |
|
L****8 发帖数: 3938 | 29 为啥不能vector 是不是没有copy/move constructor
古老的c++程序猿一般都没有这个概念 |
|
i***c 发帖数: 26 | 30 new std::vector(PoleAccess::Load(...)) 是 move construct,PoleAccess:
:Load的返回值没有名字,是rvalue |
|
发帖数: 1 | 31
那你也只能这么做了,麻烦的就是ownership自己维护。
另外其实new一个vector看着也别扭,如果你用c++17的话,可以考虑把返回值改成std: |
|
|
g*****y 发帖数: 6325 | 33 是这样啊。 谢谢回答。 可以说说为什么每次pET27b(+)dna的260/230都低于2吗? 一
起做的其他vector都很好。
请问如果我要表达蛋白是用pet27b好呢,还是pGEMEX-1 好呢? |
|
|
j*****5 发帖数: 24 | 35 i am trying to making a SHRNA lentivirus vector ( pRNAT from Gene script),
however, i was unable to get positive clone, And the yield of the plasmid
is also very low ( around 200ng/ul) I used HB101 E.coli competent cells,
Anybody can help me out? Thanks in advance. |
|
p******i 发帖数: 1092 | 36 如果不放心:
带2层手套,穿一次性的LAB COAT,戴N95口罩,戴MASK……
大家用的LENTIVIRUS其实没有HIV恐怖吧……
HIV 是3级LAB了……
LENTIVIRUS的VECTOR,1-2级……
我以前做过一些……开始怕怕,后来就麻木了,汗…… |
|
i***a 发帖数: 11095 | 37 n多年前做过,应该挺简单的
若是30bp的话
___________________
_____________________
如上图一样设计引物,中间15-20个碱基配对,两端再加上6个碱基的内切酶位点,再各
加3-4个保护碱基
正常PCR后,电泳,纯化,测浓度,各自酶切,失活,酒精沉淀,再溶,然后用T4连接酶连接
clony PCR的时候可以用primer之一跟vector上附近的一个primer试试看 |
|
g*********5 发帖数: 2533 | 38 I think mutation is the easiest way to do. just with quikchange kit, about
200 bucks.
because your pcr fragment is smaller than 30 bp, so you could design primer
with this sequence and flanked with vector sequence, 15 bp each, then use
this 60 bp primer pair do insert mutation, just one PCR and transform.
good luck |
|
g*********r 发帖数: 59 | 39 I wonder whether anyone has experience on this retrvirus vector. Tried to
amplify it several time. the plasmid yield from most clones are super low.
Any way to solve this issue?
THanks! |
|
F**********e 发帖数: 158 | 40 you are right, this vector get a very low yeild
transform again may help a little
we just use much more bacteria |
|
X***n 发帖数: 366 | 41 DH5a or Invitrogen Stbl3? It says Stbl3 is better for retroviral vector. |
|
m**z 发帖数: 787 | 42 should increase gel concentration not decrease ba
vector usually has other restriction sites you can use for your purpose |
|
y******8 发帖数: 1764 | 43 cut the vector into halves. |
|
c******r 发帖数: 3778 | 44 多数vector的p/k gene里面都有一个切点,你找找看 |
|
y******8 发帖数: 1764 | 45 check the PcR-XL-TOPO vector sequence. |
|
a****k 发帖数: 1130 | 46 是应该浓度大一点来分,前阵子也遇到同样的问题,Topo-XL和一个3kb多一点的基因,
我们postdoc试了0.6%左右的胶,结果根本分不开,反而后来我们用了1%还是稍微再高一
点的就分开了。另外,vector的sequence网上没有吗? |
|
|
|
T**********t 发帖数: 1604 | 49 commercial的vector也应该给全序列的,不给的话谁敢用。。。 |
|
d****d 发帖数: 214 | 50 Dear friends,
I would like to construct a B cell-specific retrovirus expression vector. I
am wondering whether any colleague has any suggestions or similar experience
. I would like to use Emu enhancer to confer the B cell-specificity. But I
am not sure whether use a VH promoter or any mini promoter will do the job.
Thanks! |
|