From debf4b70db81cff0dc22dc018c84cdcfd3eedbb7 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 3 Nov 2021 17:20:20 +0100 Subject: Cleanup: Avoid redundant template parameter in BLI serializing API The `ContainerValue` template can obtain the type of the contained value via the given `Container` type, simply using `Container::value_type`. Use this as the default way to determine the value type which simplifies using the template. If necessary the value type can be passed explicitly still. --- source/blender/blenlib/BLI_serialize.hh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_serialize.hh b/source/blender/blenlib/BLI_serialize.hh index 7b8aa03b807..088243b3a30 100644 --- a/source/blender/blenlib/BLI_serialize.hh +++ b/source/blender/blenlib/BLI_serialize.hh @@ -103,11 +103,11 @@ using IntValue = PrimitiveValue; using DoubleValue = PrimitiveValue; using BooleanValue = PrimitiveValue; -template class ContainerValue; +template +class ContainerValue; /* ArrayValue stores its items as shared pointer as it shares data with a lookup table that can * be created by calling `create_lookup`. */ -using ArrayValue = - ContainerValue>, std::shared_ptr, eValueType::Array>; +using ArrayValue = ContainerValue>, eValueType::Array>; /** * Class containing a (de)serializable value. @@ -234,11 +234,11 @@ template< /** The container type where the elements are stored in. */ typename Container, - /** Type of the data inside the container. */ - typename ContainerItem, - /** ValueType representing the value (object/array). */ - eValueType V> + eValueType V, + + /** Type of the data inside the container. */ + typename ContainerItem> class ContainerValue : public Value { public: using Items = Container; @@ -275,8 +275,7 @@ using ObjectElementType = std::pair>; * Object is a key-value container where the key must be a std::string. * Internally it is stored in a blender::Vector to ensure the order of keys. */ -class ObjectValue - : public ContainerValue, ObjectElementType, eValueType::Object> { +class ObjectValue : public ContainerValue, eValueType::Object> { public: using LookupValue = std::shared_ptr; using Lookup = Map; -- cgit v1.2.3