Skip to content

Commit d4902c0

Browse files
authored
ODR violation because of defaulting parameter of template function by lambda declaration. (#1080)
1 parent 6a08517 commit d4902c0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

hazelcast/include/hazelcast/client/protocol/ClientMessage.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ struct HAZELCAST_API is_trivial_entry_vector<
195195
*/
196196
class HAZELCAST_API ClientMessage
197197
{
198+
template<typename T>
199+
struct default_nullable_decoder;
200+
198201
public:
199202
static constexpr size_t EXPECTED_DATA_BLOCK_SIZE = 1024;
200203

@@ -1002,10 +1005,8 @@ class HAZELCAST_API ClientMessage
10021005
}
10031006

10041007
template<typename T>
1005-
boost::optional<T> get_nullable(std::function<T(ClientMessage&)> decoder =
1006-
[](ClientMessage& msg) {
1007-
return msg.get<T>();
1008-
})
1008+
boost::optional<T> get_nullable(
1009+
std::function<T(ClientMessage&)> decoder = default_nullable_decoder<T>{})
10091010
{
10101011
if (next_frame_is_null_frame()) {
10111012
// skip next frame with null flag
@@ -1439,6 +1440,12 @@ class HAZELCAST_API ClientMessage
14391440
static const frame_header_type BEGIN_FRAME;
14401441
static const frame_header_type END_FRAME;
14411442

1443+
template<typename T>
1444+
struct default_nullable_decoder
1445+
{
1446+
T operator()(ClientMessage& msg) const { return msg.get<T>(); }
1447+
};
1448+
14421449
template<typename T>
14431450
void set_primitive_vector(const std::vector<T>& values,
14441451
bool is_final = false)

0 commit comments

Comments
 (0)