Boost logo

Boost :

From: Daggumati, Rajesh (rajesh.daggumati_at_[hidden])
Date: 2021-11-18 19:41:10

Hi Team,

While doing typecasting from boost::any to DecodeErrorPayload_t, its throwing bad_any_cast ..

class RegisterIONotification
       enum NotifyType {
              NotifyType Type;
              boost::any Payload;
              typedef boost::tuple<std::string, BinaryBuffer_t> DecodeErrorPayload_t;
  RegisterIONotification(NotifyType type;,boost::any payload)

I have called RegisterIONotification from other class function.

void RegisterIOThreaded::OnDecodeError( const std::string& error, BinaryBuffer_t data )
        RegisterIONotification notify(RegisterIONotification::TypeDecodeError ,make_tuple(error, data));

While testing, I am getting bad_any_cast exception.

        RegisterIONotification notify = sink.GetDataById(ID::NOTIFY_COMMS_STATUS, 0).GetValue<RegisterIONotification>();
        ASSERT_EQ(RegisterIONotification::TypeDecodeError, notify.Type); //passed
         RegisterIONotification::DecodeErrorPayload_t payload;
        ASSERT_NO_THROW(payload = boost::any_cast<RegisterIONotification::DecodeErrorPayload_t>(notify.Payload));// Here its got failed...Please help me to fix this.

Rajesh D
Please be advised that this email may contain confidential information. If you are not the intended recipient, please notify us by email by replying to the sender and delete this message. The sender disclaims that the content of this email constitutes an offer to enter into, or the acceptance of, any agreement; provided that the foregoing does not invalidate the binding effect of any digital or other electronic reproduction of a manual signature that is included in any attachment.

Boost list run by bdawes at, gregod at, cpdaniel at, john at