[ 
https://issues.apache.org/jira/browse/THRIFT-5773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878870#comment-17878870
 ] 

Mario Emmenlauer commented on THRIFT-5773:
------------------------------------------

Sorry to be a bit late to the party. I have just updated boost to 1.86.0 
(current latest), and thrift to current latest master. Now the UUID support 
does not build for me. I can see that a relevant change was in the PR for this 
issue, but I don't know if boost 1.86.0 is part of the  breaking change.

The following code does not build for me:
{code}
  TUuid(const boost::uuids::uuid& buuid) noexcept
  {
    std::copy(std::begin(buuid.data), std::end(buuid.data), 
std::begin(this->data_));
  }
{code}

I think the reason is that according to 
https://www.boost.org/doc/libs/1_86_0/libs/uuid/doc/html/uuid.html#changes_changes_in_boost_1_86_0_major_update,
 the use of the data member is now discouraged, and does not work in all cases 
any more. The error I get with clang 18 is:
{code}
[build] /data/tmp/Debug/thrift/lib/cpp/src/thrift/TUuid.h:93:15: error: no 
matching function for call to 'begin'
[build]    93 |     std::copy(std::begin(buuid.data), std::end(buuid.data), 
std::begin(this->data_));
[build]       |               ^~~~~~~~~~
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/initializer_list:90:5:
 note: candidate template ignored: could not match 'initializer_list<_Tp>' 
against 'data_type'
[build]    90 |     begin(initializer_list<_Tp> __ils) noexcept
[build]       |     ^
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/range_access.h:52:5:
 note: candidate template ignored: substitution failure [with _Container = 
const data_type]: no member named 'begin' in 'boost::uuids::uuid::data_type'
[build]    52 |     begin(_Container& __cont) -> decltype(__cont.begin())
[build]       |     ^                                            ~~~~~
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/range_access.h:63:5:
 note: candidate template ignored: substitution failure [with _Container = 
data_type]: no member named 'begin' in 'boost::uuids::uuid::data_type'
[build]    63 |     begin(const _Container& __cont) -> decltype(__cont.begin())
[build]       |     ^                                                  ~~~~~
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/range_access.h:95:5:
 note: candidate template ignored: could not match '_Tp[_Nm]' against 'const 
data_type'
[build]    95 |     begin(_Tp (&__arr)[_Nm]) noexcept
[build]       |     ^
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/range_access.h:113:31:
 note: candidate template ignored: could not match 'valarray<_Tp>' against 
'const data_type'
[build]   113 |   template<typename _Tp> _Tp* begin(valarray<_Tp>&) noexcept;
[build]       |                               ^
[build] 
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/range_access.h:114:37:
 note: candidate template ignored: could not match 'const valarray<_Tp>' 
against 'const data_type'
[build]   114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) 
noexcept;
[build]       |                                     ^
{code}

I'm not really knowledgeable with boost::uuids, but according to a quick 
search, the iterators are available directly on the uuid? So the following 
compiles for me:
{code}
  TUuid(const boost::uuids::uuid& buuid) noexcept
  {
    std::copy(std::begin(buuid), std::end(buuid), std::begin(this->data_));
  }
{code}

Opinions?

> UUID wrapper for C++
> --------------------
>
>                 Key: THRIFT-5773
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5773
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C++ - Compiler
>            Reporter: Carel
>            Assignee: Carel
>            Priority: Major
>             Fix For: 0.21.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Continuation of THRIFT-5772
> Add a strong wrapper type for UUID support in C++



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to