使用STL C++ hash_map ...
class MyKeyObject
{
std::string str1;
std::string str2;
bool operator==(...) { this.str1 == that.str1 ... }
};
class MyData
{
std::string data1;
int data2;
std::string etcetc;
};
Run Code Online (Sandbox Code Playgroud)
像这样...
MyKeyObject a = MyKeyObject(...);
MyData b = MyData(...);
stdext::hash_map <MyKeyObject, MyData> _myDataHashMap;
_myDataHashMap[ a ] = b;
Run Code Online (Sandbox Code Playgroud)
我得到了大量的错误.这是前三个......
错误1错误C2784:'bool std :: operator <(const std :: _ Tree <_Traits>&,const std :: _ Tree <_Traits>&)':无法推断'const std :: _ Tree <_Traits>的模板参数&'from'const MyKeyObject'c:\ program files\microsoft visual studio 8\vc\include\functional 143
错误2错误C2784:'bool std :: operator …
假设你有这种格式的字符串.
1月11日,"111"11月1日,"1101"10月13日,"1013"等
所以基本上所有你想解析它并存储在两个变量日期和月份.
我不需要解析代码,我可以很容易地做到这一点.我只是想知道是否有人知道使用类似DateTime.TryParse()或类似的东西的方法.
干杯
我目前有动态数组:
char *myData[500][10]; //myData is the name of an array of[500][10] pointers to type char.
Run Code Online (Sandbox Code Playgroud)
我想创建一个静态2d数组,500行X 10列,每个元素存储40个字符的内存.
以下是宣布这一点的正确方法吗?
char myData[500][10][40];
Run Code Online (Sandbox Code Playgroud) 我认为我想做的是一项相当普遍的任务,但我在网上找不到任何参考.我有带标点符号的文字,我想要一个单词列表.
"Hey, you - what are you doing here!?"
Run Code Online (Sandbox Code Playgroud)
应该
['hey', 'you', 'what', 'are', 'you', 'doing', 'here']
Run Code Online (Sandbox Code Playgroud)
但是Python str.split()只能使用一个参数,所以在用空格分割之后,我所有的单词都带有标点符号.有任何想法吗?
我有一个带有动作的控制器:
class GameController < ApplicationController
before_filter :set_titles
def prestart
end
def wait
end
def play (game)
end
def button
end
def finish
end
def set_titles
end
Run Code Online (Sandbox Code Playgroud)
set_titles将获取页面标题(以及所有操作的其他常规属性)所有其他操作都会检查某些内容并呈现视图.
如何RESTful-ize这个.我只能想到创建一个Wait_player控制器,一个play_game控制器等,所有这些只会有一个show动作.但这看起来很笨拙,更难以在同一个控制器中遵循所有这些相关的操作.
我希望这是热,这是今天的第二个问题,这是另一个问题.比较简单的东西......
我有这个问题......
while ($resultV = mysql_fetch_assoc($metQueryViews)) { $allViews[] = $resultV; }
Run Code Online (Sandbox Code Playgroud)
它的日期是: -
date Count
NULL 6
14-5-2009 12
15-5-2009 21
26-6-2009 18
29-6-2009 61
Run Code Online (Sandbox Code Playgroud)
我正在尝试构建一个读出来的数组
"14-5-2009" = > "12"
Run Code Online (Sandbox Code Playgroud)
但是,上面的while语句产生的似乎是多维数组或sommet,其字段名称为>> value.
关于一张小明信片的想法是最受欢迎的.
我知道SqlContext.WindowsIdentity返回正在执行命令的当前用户(在CLR触发器中),但是,这仅适用于经过Windows身份验证的用户.如果是sql server用户,我如何获得用户名?任何帮助表示赞赏.
你会使用哪种分布式锁服务?
要求是:
我对"它可以在数据库上完成"或"它可以在JavaSpaces上完成"等答案不感兴趣 - 我知道.我对一个现成的,开箱即用的,经过验证的实现感兴趣.
我有一台安装了Python 2.3,2.6和3.0的Windows机器,以及安装了Cygwin的2.5机器.我已经下载了pexpect包,但是当我运行"python setup.py install"时,它安装到2.6安装.
我怎么能安装到Cygwin Python安装或任何其他安装?
我发现自己这样做了.
$jq("button").filter(function(){
return this.id.match(/^user_(\d+)_edit$/);
}).click(function(){
var matches = this.id.match(/^user_(\d+)_edit$/);
var user_id = matches[1];
alert('click on user edit button with ID ' + user_id);
});
Run Code Online (Sandbox Code Playgroud)
所以我想将click事件应用于某些按钮,并且在click事件处理程序中我需要用户ID.有没有办法可以避免第二场比赛?
$jq("button").filter(function(){
return this.id.match(/^user_(\d+)_edit$/);
}).click(function(){
var user_id = some_magic_variable;
alert('click on user edit button with ID ' + user_id);
});
Run Code Online (Sandbox Code Playgroud)
谢谢.