[llvm-commits] [PATCH] YAML I/O for review

Sean Silva silvas at purdue.edu
Wed Dec 5 12:16:57 PST 2012


On Wed, Dec 5, 2012 at 2:58 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> +  struct IntVector : public std::vector<int> {
> +    // The existence of this member causes YAML I/O to use a flow sequence
> +    static const bool flow = true;
> +  };
>
> Deriving types like this breaks the constructors for vector. There
> needs to be a different way to do this that doesn't require flow to be
> a member.

traits++

You can just have a template (e.g. FlowFormattingTraits<>) which you
specialize to indicate that a class should be flow formatted. The
primary template can conveniently use the presence (using SFINAE) and
value of the class member (`flow` in Nick's original patch, although I
think a longer and more unique name would be better) to select flow
formatting if there is no explicit specialization for the type.

-- Sean Silva



More information about the llvm-commits mailing list