Click here to Skip to main content
15,911,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get the C2061 syntax error: identifier 'int_' on using it.
is there a header or can I write some struct to handle that?
what is difference of int x and int_<x>?

What I have tried:

I use int x but I some error appeared that meant don't use that in template class
Posted
Updated 23-Jan-18 0:47am

It looks like you used the code from github.com/motonacciu/meta-serialization/blob/master/include/serialize.h[^].

If you have a look on top of that file, you will find
C++
namespace detail {

	template<std::size_t> struct int_{};

} // end detail namespace 
That is a template similar to those used by Boost (see the link from solution 1) to implement an Integral Constant (see The MPL Reference Manual: Integral Constant - 1.47.0[^]).

If you are using the unmodified file it should compile with recent compilers (I can't test it with VS 2015 and 2017 because I have actually no access to those).
 
Share this answer
 
Comments
saide_a 23-Jan-18 7:06am    
Many Thanks
You cannot use it with int, as it is a built in type, not a template. What exactly are you trying to achieve?
 
Share this answer
 
v2
Comments
saide_a 23-Jan-18 4:33am    
I found a source which in for serialization with c++11 when I compile it produce this error.
part of code that get error:
template <class tuple_type, size_t pos>
inline size_t get_tuple_size(const tuple_type& obj, int_<pos>)
{
constexpr size_t idx = std::tuple_size<tuple_type>::value - pos - 1;
size_t acc = get_size(std::get<idx>(obj));
return acc + get_tuple_size(obj, int_<pos - 1>());
}
Richard MacCutchan 23-Jan-18 5:02am    
What error?
saide_a 23-Jan-18 5:19am    
the C2061 syntax error: identifier 'int_'
Richard MacCutchan 23-Jan-18 5:32am    
There is no such type in C++.
You should know, that is: why do you need it? What library are you using? For instance, if you are using boost MPL than the relevant header is boost/mpl/int.hpp, as stated by the documentation: The MPL Reference Manual: int_ - 1.47.0[^].
 
Share this answer
 
v2
Comments
saide_a 23-Jan-18 3:54am    
I want it without using boost

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900