26、CORBA::Any 类型的插入与提取操作详解

CORBA::Any 类型的插入与提取操作详解

1. 插入任意类型到 CORBA::Any

在 C++ 中,将任意类型插入到 CORBA::Any 可以通过不同的方式实现。以下是示例代码:

// Inserting Anys
CORBA::Any anyToBeInserted;
anyToBeInserted <<= (CORBA::Long) 123;
theAny <<= anyToBeInserted;                 // Copying insertion
CORBA::Any_var anyToBeInsertedV = new CORBA::Any();
*anyToBeInsertedV <<= (CORBA::Long) 123;
theAny <<= *anyToBeInsertedV;                // Copying insertion
CORBA::Any * anyToBeInsertedP = new CORBA::Any();
*anyToBeInsertedP <<= (CORBA::Long) 123;
theAny <<= anyToBeInsertedP;                // Consuming insertion
theAny <<= anyToBeInsertedV._retn();        // Consuming insertion

这里有复制插入(Copying insertion)和消耗

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值