网站备案负责人一定要法人vue做的网站影响收录么

张小明 2026/1/9 20:57:52
网站备案负责人一定要法人,vue做的网站影响收录么,做网站余姚,做模板的软件当我们用“裸”指针进行类层次上的上下行转换时#xff0c;可以使用dynamic_cast。当然我们也可以使用static_cast#xff0c;只是dynamic_cast在进行下行转换的时候#xff08;即基类到派生类#xff09;具有类型检查功能#xff0c;而static_cast没有。因此存在安全问题…当我们用“裸”指针进行类层次上的上下行转换时可以使用dynamic_cast。当然我们也可以使用static_cast只是dynamic_cast在进行下行转换的时候即基类到派生类具有类型检查功能而static_cast没有。因此存在安全问题。当我们使用智能指针时如果需要进行类层次上的上下行转换时可以使用std::static_pointer_cast()、std::dynamic_pointer_cast、std::const_pointer_cast()和std::reinterpret_pointer_cast()。它们的功能和std::static_cast()、std::dynamic_cast、std::const_cast()和std::reinterpret_cast()类似只不过转换的是智能指针std::shared_ptr返回的也是std::shared_ptr类型。1、std::static_pointer_cast()当指针是智能指针时候向上转换用static_cast 则转换不了此时需要使用static_pointer_cast。2、std::dynamic_pointer_cast()当指针是智能指针时候向下转换用dynamic_cast 则转换不了此时需要使用dynamic_pointer_cast此处注意base基类需要至少有一个virtual成员函数即多态类型才能允许动态强制转换否则编译报错。3、std::const_pointer_cast()功能与std::const_cast()类似4、std::reinterpret_pointer_cast()功能与std::reinterpret_cast()类似Defined in header memorytemplate class T, class U std::shared_ptrT static_pointer_cast( const std::shared_ptrU r ) noexcept;(1) (since C11)template class T, class U std::shared_ptrT static_pointer_cast( std::shared_ptrU r ) noexcept;(2) (since C20)template class T, class U std::shared_ptrT dynamic_pointer_cast( const std::shared_ptrU r ) noexcept;(3) (since C11)template class T, class U std::shared_ptrT dynamic_pointer_cast( std::shared_ptrU r ) noexcept;(4) (since C20)template class T, class U std::shared_ptrT const_pointer_cast( const std::shared_ptrU r ) noexcept;(5) (since C11)template class T, class U std::shared_ptrT const_pointer_cast( std::shared_ptrU r ) noexcept;(6) (since C20)template class T, class U std::shared_ptrT reinterpret_pointer_cast( const std::shared_ptrU r ) noexcept;(7) (since C17)template class T, class U std::shared_ptrT reinterpret_pointer_cast( std::shared_ptrU r ) noexcept;(8) (since C20)基类和派生类的智能指针转换要使用std::dynamic_pointer_cast和std::static_pointer_cast。由于std::dynamic_pointer_cast和dynamic_cast原理一样std::static_pointer_cast和static_cast原理一样Creates a new instance of std::shared_ptr whose stored pointer is obtained from rs stored pointer using a cast expression.If r is empty, so is the new shared_ptr (but its stored pointer is not necessarily null). Otherwise, the new shared_ptr will share ownership with the initial value of r, except that it is empty if the dynamic_cast performed by dynamic_pointer_cast returns a null pointer.Let Y be typename std::shared_ptrT::element_type, then the resulting std::shared_ptrs stored pointer will be obtained by evaluating, respectively:1-2) static_castY*(r.get()).3-4) dynamic_castY*(r.get()) (If the result of the dynamic_cast is a null pointer value, the returned shared_ptr will be empty.)5-6) const_castY*(r.get()).7-8) reinterpret_castY*(r.get())The behavior of these functions is undefined unless the corresponding cast from U* to T* is well formed:1-2) The behavior is undefined unless static_castT*((U*)nullptr) is well formed.3-4) The behavior is undefined unless dynamic_castT*((U*)nullptr) is well formed.5-6) The behavior is undefined unless const_castT*((U*)nullptr) is well formed.7-8) The behavior is undefined unless reinterpret_castT*((U*)nullptr) is well formed.After calling the rvalue overloads (2,4,6,8), r is empty and r.get() nullptr, except that r is not modified for dynamic_pointer_cast (4) if the dynamic_cast fails.(since C20)Parametersr - The pointer to convertNotesThe expressions std::shared_ptrT(static_castT*(r.get())), std::shared_ptrT(dynamic_castT*(r.get())) and std::shared_ptrT(const_castT*(r.get())) might seem to have the same effect, but they all will likely result in undefined behavior, attempting to delete the same object twice!Possible implementation1、std::static_pointer_cast():template class T, class U std::shared_ptrT static_pointer_cast( const std::shared_ptrU r ) noexcept { auto p static_casttypename std::shared_ptrT::element_type*(r.get()); return std::shared_ptrT(r, p); }2、std::dynamic_pointer_cast()template class T, class U std::shared_ptrT dynamic_pointer_cast( const std::shared_ptrU r ) noexcept { if (auto p dynamic_casttypename std::shared_ptrT::element_type*(r.get())) { return std::shared_ptrT(r, p); } else { return std::shared_ptrT(); } }3、std::const_pointer_cast()template class T, class U std::shared_ptrT const_pointer_cast( const std::shared_ptrU r ) noexcept { auto p const_casttypename std::shared_ptrT::element_type*(r.get()); return std::shared_ptrT(r, p); }4、std::reinterpret_pointer_cast()template class T, class U std::shared_ptrT reinterpret_pointer_cast( const std::shared_ptrU r ) noexcept { auto p reinterpret_casttypename std::shared_ptrT::element_type*(r.get()); return std::shared_ptrT(r, p); }使用示例#include iostream #include memory struct Base { int a; virtual void f() const { std::cout I am base!\n;} virtual ~Base(){} }; struct Derived : Base { void f() const override { std::cout I am derived!\n; } ~Derived(){} }; int main(){ auto basePtr std::make_sharedBase(); std::cout Base pointer says: ; basePtr-f(); auto derivedPtr std::make_sharedDerived(); std::cout Derived pointer says: ; derivedPtr-f(); // static_pointer_cast to go up class hierarchy basePtr std::static_pointer_castBase(derivedPtr); std::cout Base pointer to derived says: ; basePtr-f(); // dynamic_pointer_cast to go down/across class hierarchy auto downcastedPtr std::dynamic_pointer_castDerived(basePtr); if(downcastedPtr) { std::cout Downcasted pointer says: ; downcastedPtr-f(); } // All pointers to derived share ownership std::cout Pointers to underlying derived: derivedPtr.use_count() \n; } Output: Base pointer says: I am base! Derived pointer says: I am derived! Base pointer to derived says: I am derived! Downcasted pointer says: I am derived! Pointers to underlying derived: 3 示例2 #include iostream // std::cout std::endl #include memory // std::shared_ptr std::dynamic_pointer_cast std::static_pointer_cast class base { public: virtual ~base(void) default; }; class derived : public base { }; class test : public base { }; int main(void) { std::cout std::boolalpha; // 两个不同的派生类对象 auto derivedobj std::make_sharedderived(); auto testobj std::make_sharedtest(); // 隐式转换 derived-base std::shared_ptrbase pointer1 derivedobj; // static_pointer_cast derived-base auto pointer2 std::static_pointer_castbase(derivedobj); // dynamic_pointer_cast base-derived auto pointer3 std::dynamic_pointer_castderived(pointer1); std::cout (pointer3 nullptr) std::endl; // dynamic_pointer_cast base-derived auto pointer4 std::dynamic_pointer_casttest(pointer1); std::cout (pointer4 nullptr) std::endl; return 0; }输出结果falsetruestd::reinterpret_pointer_cast()和std::const_pointer_cast()示例代码#include memory #include cassert #include cstdint int main() { std::shared_ptrint foo; std::shared_ptrconst int bar; foo std::make_sharedint(10); bar std::const_pointer_castconst int(foo); std::cout *bar: *bar std::endl; *foo 20; std::cout *bar: *bar std::endl; std::shared_ptrstd::int8_t[] p(new std::int8_t[4]{1, 1, 1, 1}); std::shared_ptrstd::int32_t[] q std::reinterpret_pointer_caststd::int32_t[](p); std::int32_t r q[0]; std::int32_t x (1 8) | (1 16) | (1 24) | 1; assert(r x); return 0; }输出*bar: 10*bar: 20
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

毕业设计网站开发类题目wordpress分享到+滑动

在我们这个信息爆炸的时代,从海量数据中快速找到需要的内容已成为各种应用的核心需求。无论是搜索引擎为你推荐相关网页,还是购物平台为你筛选心仪商品,抑或是大型语言模型为你检索相关知识,背后都离不开一项叫做"向量相似性…

张小明 2026/1/3 23:08:15 网站建设

南通门户网站建设方案怎样制作网站后台

接口测试的目的 API 测试作为集成测试的一部分,经过被测应用的接口(API)来确定是否在功能、可靠性、性能和安全方面达到预期的软件测试。因为 API 都没有 GUI 界面,API 测试都是在通信层进行的。 1.建立接口用例集 Postman功能…

张小明 2026/1/3 23:06:14 网站建设

wordpress网站嵌入商城南京商城网站开发设计

在无线网络中有一种故障极具欺骗性:终端显示Wi-Fi已连接,信号强、速率高、无漫游,但所有业务访问失败,重连、换AP、重启终端都无效。这类问题90%不在射频也不在链路,而是在AC与AP的控制 / 数据平面关系被悄悄切断 一、故障现象:无线看起来一切正常但完全不能用 用户侧反…

张小明 2026/1/3 23:04:12 网站建设

做网站的怎样找客户建设一个网站需要条件

探索 Linux 服务器替代方案及开源服务 在当今的 IT 领域,企业对于服务器系统和相关服务的选择至关重要。从成本效益、安全性到功能的多样性,每一个因素都影响着企业的决策。Linux 以其开源、灵活和稳定的特性,成为了替代传统 Windows 服务器的有力选择。下面将深入介绍 Lin…

张小明 2026/1/3 23:02:10 网站建设

石家庄专门做网站的公司媒介

企业计算机管理与服务器管理指南 1. 企业计算机管理 在企业计算机管理中,我们可以利用 PowerShell 和 WMI (Windows Management Instrumentation)来完成多种任务,以下是一些常见操作的介绍。 1.1 检测热修复是否安装 可以使用 Test-HotfixInstallation 脚本来确定特定…

张小明 2026/1/3 23:00:08 网站建设