小编Eri*_*ing的帖子

mysql有效地将2个表连接到相同的2个表

我有2个表可以简化为这种结构:

表格1:

+----+----------+---------------------+-------+
| id | descr_id |        date         | value |
+----+----------+---------------------+-------+
| 1  |        1 | 2013-09-20 16:39:06 |     1 |
+----+----------+---------------------+-------+
| 2  |        2 | 2013-09-20 16:44:06 |     1 |
+----+----------+---------------------+-------+
| 3  |        3 | 2013-09-20 16:49:06 |     5 |
+----+----------+---------------------+-------+
| 4  |        4 | 2013-09-20 16:44:06 |   894 |
+----+----------+---------------------+-------+
Run Code Online (Sandbox Code Playgroud)

表2:

+----------+-------------+
| descr_id | description |
+----------+-------------+
|       1  | abc         |
+----------+-------------+
|       2  | abc         |
+----------+-------------+
|       3  | …
Run Code Online (Sandbox Code Playgroud)

mysql performance join time-series deduplication

5
推荐指数
1
解决办法
158
查看次数

做一些奇怪的事情的c ++匿名构造函数

此示例程序显示如何调用不同的构造函数,具体取决于是传入局部变量,全局变量还是匿名变量.这里发生了什么?

std::string globalStr;
class aClass{
public:
  aClass(std::string s){
    std::cout << "1-arg constructor" << std::endl;
  }
  aClass(){
    std::cout << "default constructor" << std::endl;
  }
  void puke(){
    std::cout << "puke" << std::endl;
  }
};

int main(int argc, char ** argv){
  std::string localStr;
  //aClass(localStr); //this line does not compile
  aClass(globalStr);  //prints "default constructor"
  aClass(""); //prints "1-arg constructor"
  aClass(std::string("")); //also prints "1-arg constructor"
  globalStr.puke(); //compiles, even though std::string cant puke.
}
Run Code Online (Sandbox Code Playgroud)

鉴于我可以调用globalStr.puke(),我猜测通过调用aClass(globalStr);,它正在创建一个名为globalStrtype 的局部变量aClass,而不是全局变量globalStr.调用aClass(localStr); …

c++ anonymous default-constructor

5
推荐指数
1
解决办法
119
查看次数