diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-12 18:44:52 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-12 18:44:52 +0200 |
| commit | 857bdd55e92b5910852d1215bf5cef43e78b5ecb (patch) | |
| tree | 5d8b5e773aa09a81f8207799afab0bdb762b4db0 /include | |
| parent | 65750c0c2941c7c71640ad1b9bc8ff43b45889a9 (diff) | |
| download | Project-Tick-857bdd55e92b5910852d1215bf5cef43e78b5ecb.tar.gz Project-Tick-857bdd55e92b5910852d1215bf5cef43e78b5ecb.zip | |
Add initializer list constructors for tag_list
Diffstat (limited to 'include')
| -rw-r--r-- | include/tag_list.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/tag_list.h b/include/tag_list.h index 2603e4a5ca..594d630547 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -28,6 +28,12 @@ namespace nbt { +//Forward declarations +class tag_list; +class tag_compound; +class tag_byte_array; +class tag_int_array; + ///Tag that contains multiple unnamed tags of the same type class tag_list : public detail::crtp_tag<tag_list> { @@ -49,6 +55,25 @@ public: ///Constructs an empty list with the given content type tag_list(tag_type type); + ///Constructs a list with the given contents + tag_list(std::initializer_list<int8_t> init); + tag_list(std::initializer_list<int16_t> init); + tag_list(std::initializer_list<int32_t> init); + tag_list(std::initializer_list<int64_t> init); + tag_list(std::initializer_list<float> init); + tag_list(std::initializer_list<double> init); + tag_list(std::initializer_list<std::string> init); + tag_list(std::initializer_list<tag_byte_array> init); + tag_list(std::initializer_list<tag_list> init); + tag_list(std::initializer_list<tag_compound> init); + tag_list(std::initializer_list<tag_int_array> init); + + /** + * @brief Constructs a list with the given contents + * @throw std::bad_cast if the tags are not all of the same type + */ + tag_list(std::initializer_list<value> init); + /** * @brief Accesses a tag by index with bounds checking * |
