我可以在调用另一个构造函数之前做一些处理吗?
C++ : can I do some processing before calling another constructor?
我有一个有两个构造函数的类。
class Foo {
Foo(B b) {... }
Foo(int n) : Foo(buildBFromInt(n)) {} ??
}
第一个接受某个对象,我想要第二个,它首先从一个更简单的类型创建对象。
从c++ 11开始是可能的。
相关文章:
- 为什么我的 IExtractIcon 处理程序没有被调用?
- 如何使用对C函数和类对象的外部调用来处理C++头文件
- 处理类内的回调时,必须调用对非静态成员函数的引用
- 如何使用从处理程序调度的最终回调将响应异步返回给调用方on_read?
- 未调用 signal() 指定的处理程序
- 如何调用处理程序
- Java(或C++)如何处理接口中定义的方法的调用
- ESP-CoAP 服务器调用资源处理程序,不接收包
- 是否有可以处理方法调用依赖关系的设计模式?
- 异步操作的 Asio 处理程序在其同步对应项正常工作时不会调用
- cmake:生成批处理文件调用cl.exe
- 为什么我的中断被调用,但不会进入处理程序?
- 对象析构函数在多线程处理时不断被调用,但该对象并未超出范围
- 编译器在 C/C++ 中通过指针调用函数时如何正确处理 ABI
- 终止处理程序在哪个线程中调用?
- 在调用进程的上下文中通过 win32 执行批处理,从而保留环境变量
- 防止线程在处理异常后在分离时调用 std::terminate()
- boost::asio 使用 post() 时没有调用处理程序,当直接调用函数时有效(io_context有工作)
- 如何处理模板类标头中的循环 #include 调用
- 如何在不调用 "-m" 选项的情况下自动化 git 提交来处理内部引号?