我不明白为什么这个代码与g ++ 4.7.2扼杀:
#include <chrono>
main ()
{
std::chrono::system_clock::time_point t1, t2 ;
std::chrono::seconds delay ;
t1 = std::chrono::system_clock::time_point::max () ;
t2 = std::chrono::system_clock::now () ;
delay = t1 - t2 ;
// t1 = t2 + delay ;
// t1 = t2 - delay ;
}
Run Code Online (Sandbox Code Playgroud)
有错误:
test.cc: In function ‘int main()’:
test.cc:10:18: error: no match for ‘operator=’ in ‘delay = std::chrono::operator,<std::chrono::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000l> >, std::chrono::duration<long int, std::ratio<1l, 1000000l> > >((*(const std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long int, std::ratio<1l, 1000000l> > >*)(& …Run Code Online (Sandbox Code Playgroud) 我正在使用该json_agg函数从PostgreSQL请求返回一个JSON数组.但是,当没有找到行时,json_agg返回一个空字符串而不是一个空的JSON数组[](如果我理解json.org,则必须使用方括号).
例如:
SELECT json_agg(t.*) FROM (SELECT 'test' AS mycol WHERE 1 = 2) AS t ;
Run Code Online (Sandbox Code Playgroud)
返回一个空字符串,而带有'1 = 1'的相同命令返回一个有效的JSON数组(使用PostgreSQL 9.5测试).
任何的想法?