看一下之前的堆栈问题 std:make_shared vs std :: shared_ptr,我试图在uni项目中实现它.这是之前的"问题":
我想不出任何情况
std::shared_ptr<Object> obj(new Object("foo", 1));会优先考虑
auto obj = std::make_shared<Object>("foo", 1);
因此我采用了这段代码:
std::shared_ptr<Triangle> pT1(new Triangle(pCanvas, 30, 30, 30, 60, 60, 30, 255, 0, 0));
Run Code Online (Sandbox Code Playgroud)
并将其修改为此代码:
auto pT1 = std::make_shared<Triangle>(pCanvas, 30, 30, 30, 60, 60, 30, 255, 0, 0);
Run Code Online (Sandbox Code Playgroud)
但是,std :: make_shared以红色下划线,当我鼠标悬停时,我得到错误:"错误:没有重载函数的实例"std :: make_shared"匹配参数列表"
我的代码使用第一行代码正确编译和执行,但如果我使用第二行,则会出现一些错误.
这些错误是:
`1> ------ Build build:Project:SIT153Canvas,配置:Debug Win32 ------ 1> main.cpp
1> c:\ users\steve\documents\visual studio 2012\projects\sit153canvas\main.cpp(54):错误C2780:'std :: shared_ptr <_Ty> std :: make_shared(_V0_t &&,_ V1_t &&,_ V2_t && ,_V3_t &&,_ V4_t &&)':预计有5个参数 …
这是我用于单项作业的简单搜索栏:
<form name="search" method="post" action="phone_search.php">
<font size="5">Best Secondhand Mobile Phones Geelong</font> - Search the site:
<input type="text" name="term" />
<input type="submit" name="search" value="Search" />
</form>
Run Code Online (Sandbox Code Playgroud)
这是我访问oracle服务器的php代码:
echo "<h2>Results</h2>";
//Null string entered
if ($term == "")
{
echo "You didn't enter anything!\n";
exit;
}
//Connect to database
$dbuser = "xxxx";
$dbpass = "xxxx";
$db = "SSID";
$connect = OCILogon($dbuser, $dbpass, $db);
//Database connection error
if (!$connect)
{
echo "An error occurred connecting to the database.\n";
exit;
}
//Make all lowercase
$term …Run Code Online (Sandbox Code Playgroud)