summaryrefslogtreecommitdiff
path: root/brillo/any_internal_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'brillo/any_internal_impl.h')
-rw-r--r--brillo/any_internal_impl.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/brillo/any_internal_impl.h b/brillo/any_internal_impl.h
index 932f0ee..fea0aac 100644
--- a/brillo/any_internal_impl.h
+++ b/brillo/any_internal_impl.h
@@ -142,8 +142,8 @@ class Buffer; // Forward declaration of data buffer container.
// Abstract base class for contained variant data.
struct Data {
virtual ~Data() {}
- // Returns the type information for the contained data.
- virtual const std::type_info& GetType() const = 0;
+ // Returns the type name for the contained data.
+ virtual const char* GetTypeName() const = 0;
// Copies the contained data to the output |buffer|.
virtual void CopyTo(Buffer* buffer) const = 0;
// Moves the contained data to the output |buffer|.
@@ -165,7 +165,7 @@ struct TypedData : public Data {
// NOLINTNEXTLINE(build/c++11)
explicit TypedData(T&& value) : value_(std::move(value)) {}
- const std::type_info& GetType() const override { return typeid(T); }
+ const char* GetTypeName() const override { return typeid(T).name(); }
void CopyTo(Buffer* buffer) const override;
void MoveTo(Buffer* buffer) override;
bool IsConvertibleToInteger() const override {
@@ -268,7 +268,7 @@ class Buffer final {
using Type = typename std::decay<T>::type;
using DataType = TypedData<Type>;
Data* ptr = GetDataPtr();
- if (ptr && ptr->GetType() == typeid(Type)) {
+ if (ptr && strcmp(ptr->GetTypeName(), typeid(Type).name()) == 0) {
// We assign the data to the variant container, which already
// has the data of the same type. Do fast copy/move with no memory
// reallocation.