[PATCH] D58969: Expose template parameters of endian specific types as class members
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 08:16:00 PST 2019
labath created this revision.
labath added reviewers: zturner, Bigcheese.
Herald added a subscriber: kristina.
Herald added a project: LLVM.
This allows generic code to query these parameters, and is a common
practice in a lot of other template classes. I'm mainly interested in
the ValueType paramemter here, but I've added others for symmetry.
Repository:
rL LLVM
https://reviews.llvm.org/D58969
Files:
include/llvm/Support/Endian.h
Index: include/llvm/Support/Endian.h
===================================================================
--- include/llvm/Support/Endian.h
+++ include/llvm/Support/Endian.h
@@ -203,10 +203,14 @@
namespace detail {
-template<typename value_type,
- endianness endian,
- std::size_t alignment>
+template<typename ValueType,
+ endianness Endian,
+ std::size_t Alignment>
struct packed_endian_specific_integral {
+ using value_type = ValueType;
+ static constexpr endianness endian = Endian;
+ static constexpr std::size_t alignment = Alignment;
+
packed_endian_specific_integral() = default;
explicit packed_endian_specific_integral(value_type val) { *this = val; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58969.189327.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/6a4387f2/attachment.bin>
More information about the llvm-commits
mailing list