Skip to content

Commit a8d6e25

Browse files
committed
Release 3.0.0
1 parent 227cd31 commit a8d6e25

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cmake_minimum_required( VERSION 3.15 FATAL_ERROR )
1111

1212
project(
1313
variant_lite
14-
VERSION 2.0.0
14+
VERSION 3.0.0
1515
# DESCRIPTION "A C++17-like variant, a type-safe union for C++98, C++11 and later in a single-file header-only library"
1616
# HOMEPAGE_URL "https://github.com/martinmoene/variant-lite"
1717
LANGUAGES CXX )

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Or, if you use the [conan package manager](https://www.conan.io/), you might fol
114114
| Purpose | Type | Notes |
115115
|-----------------------|------|-------|
116116
| Type-safe union | template&lt; class T0...T6 ><br>class **variant** | non-standard: may hold up to seven types |
117-
| Default constructible | class **monostate** |Type to make variant default constructible |
118-
| Error reporting | class **bad_variant_access** |&nbsp; |
119-
| In-place construction | struct **in_place_tag** |&nbsp; |
117+
| Default constructible | class **monostate** | Type to make variant default constructible |
118+
| Error reporting | class **bad_variant_access** | &nbsp; |
119+
| In-place construction | struct **in_place_tag** | &nbsp; |
120120
| &nbsp; | **in_place** | select type or index for in-place construction |
121121
| &nbsp; | **in_place_type** | select type for in-place construction |
122122
| &nbsp; | **in_place_index** | select index for in-place construction |
@@ -134,8 +134,8 @@ Or, if you use the [conan package manager](https://www.conan.io/), you might fol
134134
| Kind | Std | Method | Result |
135135
|--------------|------|----------------------------------------------|--------|
136136
| Construction |&nbsp;| **variant**() | default-construct first type |
137-
| &nbsp; |&nbsp;| **variant**( Tx const & x ) | copy-construct with value type Tx |
138-
| &nbsp; |C++11 | **variant**( Tx && x ) | move-construct with value type Tx |
137+
| &nbsp; |C++98 | **variant**( Tx const & x ) | copy-construct with value type Tx, non-converting |
138+
| &nbsp; |C++11 | **variant**( T && x ) | universal-construct from value type T |
139139
| &nbsp; |&nbsp;| **variant**( variant const & rhs ) | copy-construct from other variant |
140140
| &nbsp; |C++11 | **variant**( variant && rhs ) | move-construct from other variant |
141141
| &nbsp; |C++11 | template&lt; class T, class... Args ><br>explicit **variant**( in_place_type_t(T), Args&&... args) | in-place-construct type T |
@@ -145,8 +145,8 @@ Or, if you use the [conan package manager](https://www.conan.io/), you might fol
145145
| Destruction |&nbsp;| **~variant**() | destruct current content |
146146
| Assignment |&nbsp;| variant & **operator=**( variant const & rhs ) | copy-assign from other |
147147
| &nbsp; |C++11 | variant & **operator=**( variant && rhs ) | move-assign from other |
148-
| &nbsp; |C++11 | template&lt; class Tx ><br>variant & **operator=**( Tx && t ) | move-assign from value |
149-
| &nbsp; |< C++11 | template&lt; class Tx ><br>variant & **operator=**( Tx const & t ) | copy-assign from value;<br>non-standard |
148+
| &nbsp; |C++11 | template&lt; class Tx ><br>variant & **operator=**( T && t ) | universal-assign from value type T |
149+
| &nbsp; |C++98 | template&lt; class Tx ><br>variant & **operator=**( Tx const & t ) | copy-assign from value;<br>non-standard |
150150
| State |&nbsp;| std::size_t **index**() const | index of current content's type |
151151
| &nbsp; |&nbsp;| bool **valueless_by_exception**() const | true if no content is present |
152152
| Emplace |C++11 | template&lt; class T, class... Args ><br>T & **emplace**( Args&&... args ) | emplace type T |

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from conans import ConanFile, CMake
22

33
class VariantLiteConan(ConanFile):
4-
version = "2.0.0"
4+
version = "3.0.0"
55
name = "variant-lite"
66
description = "A single-file header-only version of a C++17-like variant, a type-safe union for C++98, C++11 and later"
77
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"

include/nonstd/variant.hpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef NONSTD_VARIANT_LITE_HPP
1111
#define NONSTD_VARIANT_LITE_HPP
1212

13-
#define variant_lite_MAJOR 2
13+
#define variant_lite_MAJOR 3
1414
#define variant_lite_MINOR 0
1515
#define variant_lite_PATCH 0
1616

@@ -1173,7 +1173,7 @@ struct helper
11731173
case 13: as<T13>( data )->~T13(); break;
11741174
case 14: as<T14>( data )->~T14(); break;
11751175
case 15: as<T15>( data )->~T15(); break;
1176-
1176+
11771177
}
11781178
}
11791179

@@ -1216,7 +1216,7 @@ struct helper
12161216
case 13: new( to_value ) T13( std::move( *as<T13>( from_value ) ) ); break;
12171217
case 14: new( to_value ) T14( std::move( *as<T14>( from_value ) ) ); break;
12181218
case 15: new( to_value ) T15( std::move( *as<T15>( from_value ) ) ); break;
1219-
1219+
12201220
}
12211221
return from_index;
12221222
}
@@ -1241,7 +1241,7 @@ struct helper
12411241
case 13: *as<T13>( to_value ) = std::move( *as<T13>( from_value ) ); break;
12421242
case 14: *as<T14>( to_value ) = std::move( *as<T14>( from_value ) ); break;
12431243
case 15: *as<T15>( to_value ) = std::move( *as<T15>( from_value ) ); break;
1244-
1244+
12451245
}
12461246
return from_index;
12471247
}
@@ -1267,7 +1267,7 @@ struct helper
12671267
case 13: new( to_value ) T13( *as<T13>( from_value ) ); break;
12681268
case 14: new( to_value ) T14( *as<T14>( from_value ) ); break;
12691269
case 15: new( to_value ) T15( *as<T15>( from_value ) ); break;
1270-
1270+
12711271
}
12721272
return from_index;
12731273
}
@@ -1292,7 +1292,7 @@ struct helper
12921292
case 13: *as<T13>( to_value ) = *as<T13>( from_value ); break;
12931293
case 14: *as<T14>( to_value ) = *as<T14>( from_value ); break;
12941294
case 15: *as<T15>( to_value ) = *as<T15>( from_value ); break;
1295-
1295+
12961296
}
12971297
return from_index;
12981298
}
@@ -1422,7 +1422,7 @@ class variant
14221422

14231423
#if variant_CPP11_OR_GREATER
14241424
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value > 0, "Template parameter type list of variant can not be empty.");
1425-
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value <= variant_CONFIG_MAX_TYPE_COUNT, "Exceeding 33configured number of alternative types.");
1425+
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value <= variant_CONFIG_MAX_TYPE_COUNT, "Exceeding configured number of alternative types.");
14261426
// variant_STATIC_ASSERT( !detail::disjunction<std::is_reference<Types>...>::value, "Variant can not hold reference types. Maybe use std::reference_wrapper?");
14271427
// variant_STATIC_ASSERT( !detail::disjunction<std::is_array<Types>...>::value, "Variant can not hold array types.");
14281428
#endif
@@ -1459,7 +1459,7 @@ class variant
14591459
variant( T13 const & t13 ) : type_index( 13 ) { new( ptr() ) T13( t13 ); }
14601460
variant( T14 const & t14 ) : type_index( 14 ) { new( ptr() ) T14( t14 ); }
14611461
variant( T15 const & t15 ) : type_index( 15 ) { new( ptr() ) T15( t15 ); }
1462-
1462+
14631463
#endif
14641464

14651465
#if variant_CPP11_OR_GREATER
@@ -1621,7 +1621,7 @@ class variant
16211621
variant & operator=( T13 const & t13 ) { return assign_value<13>( t13 ); }
16221622
variant & operator=( T14 const & t14 ) { return assign_value<14>( t14 ); }
16231623
variant & operator=( T15 const & t15 ) { return assign_value<15>( t15 ); }
1624-
1624+
16251625
#endif
16261626

16271627
// 19.7.3.4 Modifiers
@@ -1704,8 +1704,8 @@ class variant
17041704
std::is_nothrow_move_constructible<T12>::value && std17::is_nothrow_swappable<T12>::value &&
17051705
std::is_nothrow_move_constructible<T13>::value && std17::is_nothrow_swappable<T13>::value &&
17061706
std::is_nothrow_move_constructible<T14>::value && std17::is_nothrow_swappable<T14>::value &&
1707-
std::is_nothrow_move_constructible<T15>::value && std17::is_nothrow_swappable<T15>::value
1708-
1707+
std::is_nothrow_move_constructible<T15>::value && std17::is_nothrow_swappable<T15>::value
1708+
17091709
)
17101710
#endif
17111711
{
@@ -1926,7 +1926,7 @@ class variant
19261926
case 13: swap( this->get<13>(), other.get<13>() ); break;
19271927
case 14: swap( this->get<14>(), other.get<14>() ); break;
19281928
case 15: swap( this->get<15>(), other.get<15>() ); break;
1929-
1929+
19301930
}
19311931
}
19321932

@@ -2106,7 +2106,7 @@ template< class T0, class T1, class T2, class T3, class T4, class T5, class T6,
21062106
std::is_move_constructible<T12>::value && std17::is_swappable<T12>::value &&
21072107
std::is_move_constructible<T13>::value && std17::is_swappable<T13>::value &&
21082108
std::is_move_constructible<T14>::value && std17::is_swappable<T14>::value &&
2109-
std::is_move_constructible<T15>::value && std17::is_swappable<T15>::value
2109+
std::is_move_constructible<T15>::value && std17::is_swappable<T15>::value
21102110
)
21112111
#endif
21122112
>
@@ -2166,11 +2166,11 @@ struct TypedVisitorUnwrapper<2, R, Visitor, T2>
21662166
{
21672167
const Visitor& visitor;
21682168
T2 const& val2;
2169-
2169+
21702170
TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_)
21712171
: visitor(visitor_)
21722172
, val2(val2_)
2173-
2173+
21742174
{
21752175
}
21762176

@@ -2187,12 +2187,12 @@ struct TypedVisitorUnwrapper<3, R, Visitor, T2, T3>
21872187
const Visitor& visitor;
21882188
T2 const& val2;
21892189
T3 const& val3;
2190-
2190+
21912191
TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_)
21922192
: visitor(visitor_)
21932193
, val2(val2_)
21942194
, val3(val3_)
2195-
2195+
21962196
{
21972197
}
21982198

@@ -2210,13 +2210,13 @@ struct TypedVisitorUnwrapper<4, R, Visitor, T2, T3, T4>
22102210
T2 const& val2;
22112211
T3 const& val3;
22122212
T4 const& val4;
2213-
2213+
22142214
TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_, T4 const& val4_)
22152215
: visitor(visitor_)
22162216
, val2(val2_)
22172217
, val3(val3_)
22182218
, val4(val4_)
2219-
2219+
22202220
{
22212221
}
22222222

@@ -2235,14 +2235,14 @@ struct TypedVisitorUnwrapper<5, R, Visitor, T2, T3, T4, T5>
22352235
T3 const& val3;
22362236
T4 const& val4;
22372237
T5 const& val5;
2238-
2238+
22392239
TypedVisitorUnwrapper(const Visitor& visitor_, T2 const& val2_, T3 const& val3_, T4 const& val4_, T5 const& val5_)
22402240
: visitor(visitor_)
22412241
, val2(val2_)
22422242
, val3(val3_)
22432243
, val4(val4_)
22442244
, val5(val5_)
2245-
2245+
22462246
{
22472247
}
22482248

@@ -2267,42 +2267,42 @@ struct VisitorUnwrapper
22672267
{
22682268
}
22692269

2270-
2270+
22712271
template< typename T1 >
22722272
R operator()(T1 const& val1) const
22732273
{
22742274
typedef TypedVisitorUnwrapper<2, R, Visitor, T1> visitor_type;
22752275
return VisitorApplicator<R>::apply(visitor_type(visitor, val1), r);
22762276
}
2277-
2277+
22782278
template< typename T1, typename T2 >
22792279
R operator()(T1 const& val1, T2 const& val2) const
22802280
{
22812281
typedef TypedVisitorUnwrapper<3, R, Visitor, T1, T2> visitor_type;
22822282
return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2), r);
22832283
}
2284-
2284+
22852285
template< typename T1, typename T2, typename T3 >
22862286
R operator()(T1 const& val1, T2 const& val2, T3 const& val3) const
22872287
{
22882288
typedef TypedVisitorUnwrapper<4, R, Visitor, T1, T2, T3> visitor_type;
22892289
return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3), r);
22902290
}
2291-
2291+
22922292
template< typename T1, typename T2, typename T3, typename T4 >
22932293
R operator()(T1 const& val1, T2 const& val2, T3 const& val3, T4 const& val4) const
22942294
{
22952295
typedef TypedVisitorUnwrapper<5, R, Visitor, T1, T2, T3, T4> visitor_type;
22962296
return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3, val4), r);
22972297
}
2298-
2298+
22992299
template< typename T1, typename T2, typename T3, typename T4, typename T5 >
23002300
R operator()(T1 const& val1, T2 const& val2, T3 const& val3, T4 const& val4, T5 const& val5) const
23012301
{
23022302
typedef TypedVisitorUnwrapper<6, R, Visitor, T1, T2, T3, T4, T5> visitor_type;
23032303
return VisitorApplicator<R>::apply(visitor_type(visitor, val1, val2, val3, val4, val5), r);
23042304
}
2305-
2305+
23062306
};
23072307

23082308

@@ -2330,7 +2330,7 @@ struct VisitorApplicator
23302330
case 13: return apply_visitor<13>(v, arg);
23312331
case 14: return apply_visitor<14>(v, arg);
23322332
case 15: return apply_visitor<15>(v, arg);
2333-
2333+
23342334
// prevent default construction of a const reference, see issue #39:
23352335
default: std::terminate();
23362336
}
@@ -2357,39 +2357,39 @@ struct VisitorApplicator
23572357
return apply(unwrapper, arg2, args ...);
23582358
}
23592359
#else
2360-
2360+
23612361
template< typename Visitor, typename V1, typename V2 >
23622362
static R apply(const Visitor& v, V1 const& arg1, V2 const& arg2)
23632363
{
23642364
typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
23652365
Unwrapper unwrapper(v, arg1);
23662366
return apply(unwrapper, arg2);
23672367
}
2368-
2368+
23692369
template< typename Visitor, typename V1, typename V2, typename V3 >
23702370
static R apply(const Visitor& v, V1 const& arg1, V2 const& arg2, V3 const& arg3)
23712371
{
23722372
typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
23732373
Unwrapper unwrapper(v, arg1);
23742374
return apply(unwrapper, arg2, arg3);
23752375
}
2376-
2376+
23772377
template< typename Visitor, typename V1, typename V2, typename V3, typename V4 >
23782378
static R apply(const Visitor& v, V1 const& arg1, V2 const& arg2, V3 const& arg3, V4 const& arg4)
23792379
{
23802380
typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
23812381
Unwrapper unwrapper(v, arg1);
23822382
return apply(unwrapper, arg2, arg3, arg4);
23832383
}
2384-
2384+
23852385
template< typename Visitor, typename V1, typename V2, typename V3, typename V4, typename V5 >
23862386
static R apply(const Visitor& v, V1 const& arg1, V2 const& arg2, V3 const& arg3, V4 const& arg4, V5 const& arg5)
23872387
{
23882388
typedef VisitorUnwrapper<R, Visitor, V1> Unwrapper;
23892389
Unwrapper unwrapper(v, arg1);
23902390
return apply(unwrapper, arg2, arg3, arg4, arg5);
23912391
}
2392-
2392+
23932393
#endif
23942394
};
23952395

@@ -2472,7 +2472,7 @@ struct Comparator
24722472
case 13: return get<13>( v ) == get<13>( w );
24732473
case 14: return get<14>( v ) == get<14>( w );
24742474
case 15: return get<15>( v ) == get<15>( w );
2475-
2475+
24762476
default: return false;
24772477
}
24782478
}
@@ -2497,7 +2497,7 @@ struct Comparator
24972497
case 13: return get<13>( v ) < get<13>( w );
24982498
case 14: return get<14>( v ) < get<14>( w );
24992499
case 15: return get<15>( v ) < get<15>( w );
2500-
2500+
25012501
default: return false;
25022502
}
25032503
}
@@ -2609,7 +2609,7 @@ struct hash< nonstd::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T
26092609
case 13: return nvd::hash( 13 ) ^ nvd::hash( get<13>( v ) );
26102610
case 14: return nvd::hash( 14 ) ^ nvd::hash( get<14>( v ) );
26112611
case 15: return nvd::hash( 15 ) ^ nvd::hash( get<15>( v ) );
2612-
2612+
26132613
default: return 0;
26142614
}
26152615
}

template/variant.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef NONSTD_VARIANT_LITE_HPP
1111
#define NONSTD_VARIANT_LITE_HPP
1212

13-
#define variant_lite_MAJOR 2
13+
#define variant_lite_MAJOR 3
1414
#define variant_lite_MINOR 0
1515
#define variant_lite_PATCH 0
1616

@@ -1285,7 +1285,7 @@ class variant
12851285

12861286
#if variant_CPP11_OR_GREATER
12871287
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value > 0, "Template parameter type list of variant can not be empty.");
1288-
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value <= variant_CONFIG_MAX_TYPE_COUNT, "Exceeding 33configured number of alternative types.");
1288+
variant_STATIC_ASSERT( detail::typelist_size<variant_types>::value <= variant_CONFIG_MAX_TYPE_COUNT, "Exceeding configured number of alternative types.");
12891289
// variant_STATIC_ASSERT( !detail::disjunction<std::is_reference<Types>...>::value, "Variant can not hold reference types. Maybe use std::reference_wrapper?");
12901290
// variant_STATIC_ASSERT( !detail::disjunction<std::is_array<Types>...>::value, "Variant can not hold array types.");
12911291
#endif

0 commit comments

Comments
 (0)