You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2019/01/17 02:22:00 UTC

[jira] [Assigned] (AVRO-1541) Specific.hh is over-specialized for standard C++ containers

     [ https://issues.apache.org/jira/browse/AVRO-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiruvalluvan M. G. reassigned AVRO-1541:
-----------------------------------------

    Assignee: Thiruvalluvan M. G.

> Specific.hh is over-specialized for standard C++ containers
> -----------------------------------------------------------
>
>                 Key: AVRO-1541
>                 URL: https://issues.apache.org/jira/browse/AVRO-1541
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: c++
>    Affects Versions: 1.7.6
>            Reporter: Sean Middleditch
>            Assignee: Thiruvalluvan M. G.
>            Priority: Trivial
>
> The encoders in Specific.hh for the C++ stdlib types like string, vector, etc. are over-specialized and take only specific variations of these templated templates. The specializations of codec_traits should be partial specializations to support std::string, std::vector, std::map, and so on using user-specific allocators and (for std:set and std::map) a user-specific comparator, as Avro has absolutely no reason to care about these details.
> These partial specializations will not require any API incompatible breaks.  They'd look something like:
> template <typename T, typename Allocator>
> template <>
> struct codec_traits<std::vector<T, Allocator> > {
>   void encode(Encoder& e, const std::vector<T, Allocator>& s) {
>     // ... 
>   }
>   void encode(Encoder& d, std::vector<T, Allocator>& s) {
>     // ... 
>   }
> };
> std::string could be the trickier one since it should probably be a partial specialization over the supported variants of basic_string, though partial specialization of std::string, std::u16string, std::u32string, and std::wstring (which can all have custom allocators).
> Don't forget that std::set and std::map can have both a custom allocator and a custom comparator.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)