如何从 postgresql 函数返回单行?之后我应该使用什么类型returns?这是我的代码:
create or replace function get_perf()
returns ???? as $$
select task_ext_perf.performance, task_ext_perf.unit from task_ext_perf order by task_ext_perf.tm limit 1;
$$
language sql;
Run Code Online (Sandbox Code Playgroud) 我这样做时出现异常:std :: bad_weak_ptr-> shared_from_this()
template<typename TChar>
class painter_record_t
{
.......
private:
std::shared_ptr<i_painter_t> _owner;
}
Run Code Online (Sandbox Code Playgroud)
在这里,我想在构造函数中设置“问题”对象:
template<typename TChar>
class stream_record_t : public painter_record_t<TChar>
{
public:
stream_record_t(std::shared_ptr<i_painter_t> owner) : painter_record_t(owner)
{
//...
}
}
Run Code Online (Sandbox Code Playgroud)
我有基类:
class i_painter_t
{
public:
virtual std::unique_ptr<painter_record_t<char>> get_entry() = 0;
}
Run Code Online (Sandbox Code Playgroud)
和派生类,在其中我想将智能指针发送到基本抽象类,但会出现异常:
class painter_t : public i_painter_t, public std::enable_shared_from_this<painter_t>
{
public:
std::unique_ptr<painter_record_t<char>> get_entry()
{
return std::unique_ptr<painter_record_t<char>>(new stream_record_t<char>(static_cast< std::shared_ptr<i_painter_t> >(this->shared_from_this())));
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试这样做,但是有同样的问题:
class painter_t : public i_painter_t, public std::enable_shared_from_this<painter_t>
{
public:
std::unique_ptr<painter_record_t<char>> get_entry()
{
return std::unique_ptr<painter_record_t<char>>(new stream_record_t<char>(this->shared_from_this()));
} …Run Code Online (Sandbox Code Playgroud) 我要观察内核代码打印/proc/PID/maps但无法找到这个.有人能告诉我这段代码的位置