由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++: use char * in Map
相关主题
C语言一个passing variable的问题[合集] 如何只用putchar来实现itoa?
帮忙找个错Mysterious PgSQL 8.3 crash
C++里面把数转成字符串的命令是啥啊?easy problem coconut
two general C++ question请教Matlab和IDL的处理数据能力差异
板上有 spark 大牛么?how to convert str to double
what's wrong with this scripts?variable passing?MPI I/O 问题
how to print 2 exponential digits in windows by using Perla C question
关于文件命名无法编译一个文件
相关话题的讨论汇总
话题: mapids话题: char话题: pr话题: map话题: sprintf
进入Programming版参与讨论
1 (共1页)
s****n
发帖数: 700
1
I get some problem here.
char a[40];
char b[40];
sprintf(a, "%s", "x1");
sprintf(b, "%s", "x2");

struct cmp_str
{
bool operator()(char const *a, char const *b)
{
return strcmp(a,b) < 0;
}
};

typedef std::map MAPIDS;
MAPIDS m_mapIds;
std::pair< MAPIDS::iterator, bool > _pr_id = m_mapIds.insert( MAPIDS::value_
type(a , b ));
printf("%s %s\n", _pr_id.first, _pr_id.second // look likes I can't
retrieve a and b using the pair
Please help.
e****d
发帖数: 895
2
(*_pr_id.first).first and (*_pr_id.first).second.

【在 s****n 的大作中提到】
: I get some problem here.
: char a[40];
: char b[40];
: sprintf(a, "%s", "x1");
: sprintf(b, "%s", "x2");
:
: struct cmp_str
: {
: bool operator()(char const *a, char const *b)
: {

p***o
发帖数: 1252
3
Probably the same matter as the post 20328 and 20329.

【在 e****d 的大作中提到】
: (*_pr_id.first).first and (*_pr_id.first).second.
f******y
发帖数: 2971
4
不会写C++就换一门别的语言吧。

【在 s****n 的大作中提到】
: I get some problem here.
: char a[40];
: char b[40];
: sprintf(a, "%s", "x1");
: sprintf(b, "%s", "x2");
:
: struct cmp_str
: {
: bool operator()(char const *a, char const *b)
: {

1 (共1页)
进入Programming版参与讨论
相关主题
无法编译一个文件板上有 spark 大牛么?
Linux GNU C, readlink问题what's wrong with this scripts?variable passing?
matlab 批处理文件执行顺序问题how to print 2 exponential digits in windows by using Perl
c语言如何pass变量的值关于文件命名
C语言一个passing variable的问题[合集] 如何只用putchar来实现itoa?
帮忙找个错Mysterious PgSQL 8.3 crash
C++里面把数转成字符串的命令是啥啊?easy problem coconut
two general C++ question请教Matlab和IDL的处理数据能力差异
相关话题的讨论汇总
话题: mapids话题: char话题: pr话题: map话题: sprintf