Skip to content

Commit

Permalink
opt:add constraint to the method readu32sizeanddata method
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jan 20, 2025
1 parent b8de6f0 commit dd24cb1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dict/utils/dictfile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <string>
#include <vector>
#include <QMutex>
#include <type_traits>
#include <string>

/// File utilities
namespace File {
Expand Down Expand Up @@ -80,6 +82,8 @@ public:
template< typename T >
void readU32SizeAndData( T & container )
{
static_assert(std::is_same<T, std::vector<char>>::value || std::is_same<T, std::string>::value,
"T must be either std::vector<char> or std::string");
uint32_t size = 0;
read( &size, sizeof( uint32_t ) );
if ( size > 0 ) {
Expand Down

0 comments on commit dd24cb1

Please sign in to comment.