utfcpp
                                
                                 utfcpp copied to clipboard
                                
                                    utfcpp copied to clipboard
                            
                            
                            
                        C++ Deprecation Warnings
Hey,
I'm working on a project using this, but I use C++20. I'm getting the following warning:
In file included from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_construct.h:61,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\char_traits.h:46,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\string:40,
                 from c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bitset:47,
                 from G:/GitHub/Homebrew/lovepotion/include/common/type.hpp:3,
                 from G:/GitHub/Homebrew/lovepotion/include/common/luax.hpp:3,
                 from G:/GitHub/Homebrew/lovepotion/include/objects/font/wrap_font.hpp:3:
c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
In file included from G:/GitHub/Homebrew/lovepotion/libraries/utf8/utf8.h:32:
G:/GitHub/Homebrew/lovepotion/libraries/utf8/utf8/unchecked.h:179:40: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> stru
ct std::iterator' is deprecated [-Wdeprecated-declarations]
  179 |           class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
      |                                        ^~~~~~~~
c:\msys64\opt\devkitpro\devkitarm\arm-none-eabi\include\c++\12.2.0\bits\stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
If there's something I can do about fixing this, let me know, unless the library needs to be updated to work with C++20.
I guess it is fixed since 2b1521b. You should try latest release version
Yeah, I am using the latest release version, 3.2.2. Although I'm not home at the moment to work on my code, so I can't double check right now if maybe it was some random cache issue because of CMake (I forgot to push the latest changes before leaving for the holiday, heh). I'll be back on Friday/Saturday and get back to you.
Sorry for the late reply. I double checked with a clean build and everything. It still produces the warning. It's not exactly a big deal, but it is annoying it keeps popping up.
You definitely don't have the latest version. unchecked.h:179 that causes the problem in your code looks like: class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> { That code does not exist anymore. Here is that line in the current version: https://github.com/nemtrif/utfcpp/blob/master/source/utf8/unchecked.h#L179
And here is the current declaration of the iterator type: https://github.com/nemtrif/utfcpp/blob/master/source/utf8/unchecked.h#L218
I mean, I downloaded the latest release and replaced the files. You can confirm that here. I have no idea what I can tell you otherwise.
So, you mixed up your on cocktail of the lib? In that case, the issue should be moved to the cocktail. It is definitely fixed here.
I'm not sure what you mean, honestly. I didn't modify the source code from the downloaded release.
I just looked at https://github.com/nemtrif/utfcpp/archive/refs/tags/v3.2.2.zip and it is fine. What download exactly do you use?
I have downloaded that exact same zip file.
Can you extract that file into a new directory, open file unchecked.h and look for the line that causes the warning:
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
this is the class within unchecked.h:
        // The iterator class
        template <typename octet_iterator>
          class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> { 
            octet_iterator it;
            public:
            iterator () {}
            explicit iterator (const octet_iterator& octet_it): it(octet_it) {}
            // the default "big three" are OK
            octet_iterator base () const { return it; }
            uint32_t operator * () const
            {
                octet_iterator temp = it;
                return utf8::unchecked::next(temp);
            }
            bool operator == (const iterator& rhs) const 
            { 
                return (it == rhs.it);
            }
            bool operator != (const iterator& rhs) const
            {
                return !(operator == (rhs));
            }
            iterator& operator ++ () 
            {
                ::std::advance(it, utf8::internal::sequence_length(it));
                return *this;
            }
            iterator operator ++ (int)
            {
                iterator temp = *this;
                ::std::advance(it, utf8::internal::sequence_length(it));
                return temp;
            }  
            iterator& operator -- ()
            {
                utf8::unchecked::prior(it);
                return *this;
            }
            iterator operator -- (int)
            {
                iterator temp = *this;
                utf8::unchecked::prior(it);
                return temp;
            }
          }; // class iterator
and the #define version is UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
Long story short you have an old version of the code. I just looked at your repository and it is obvious. You don't even have all the files from recent releases: compare: https://github.com/lovebrew/lovepotion/tree/dev/3.0/libraries/utf8/utf8 to https://github.com/nemtrif/utfcpp/tree/master/source/utf8.
Or compare https://github.com/nemtrif/utfcpp/blob/master/source/utf8/core.h to https://github.com/lovebrew/lovepotion/blob/dev/3.0/libraries/utf8/utf8/core.h
You are obviously missing this part:
`// Determine the C++ standard version. // If the user defines UTF_CPP_CPLUSPLUS, use that. // Otherwise, trust the unreliable predefined macro __cplusplus
#if !defined UTF_CPP_CPLUSPLUS #define UTF_CPP_CPLUSPLUS __cplusplus #endif
#if UTF_CPP_CPLUSPLUS >= 201103L // C++ 11 or later #define UTF_CPP_OVERRIDE override #define UTF_CPP_NOEXCEPT noexcept #else // C++ 98/03 #define UTF_CPP_OVERRIDE #define UTF_CPP_NOEXCEPT throw() #endif // C++ 11 or later `