standards

What type will make “std::has_unique_object_representations” return false?

老子叫甜甜 提交于 2019-12-04 03:40:47
At cppref , I see a weird type trait checker : std::has_unique_object_representations From its description, I cannot imagine any type T that make std::has_unique_object_representations<T>::value is false . Is there any counter-example? Understanding the purpose of this trait requires understanding the distinction between an objects "value representation" and its "object representation". From the standard: The object representation of an object of type T is the sequence of N unsigned char objects taken up by the object of type T , where N equals sizeof(T) . The value representation of an object

SFINAE, deduction vs. instantiation

会有一股神秘感。 提交于 2019-12-04 03:20:30
问题 This code fails to compile in most compilers but at first I intuitively expected SFINAE to protect me: typedef void (*A)(); template < typename T > struct a_metafun { typedef typename T::type type; }; template < typename T > typename a_metafun<T>::type f(T) {} template < typename T> void f(T(*)()) {} int main() { f(A()); } I can fix the problem in at least two ways: 1) Change the definition of "metafun" f() to: template < typename T > typename T::type f(T) {} 2) define "a_metafun" such that

Disable Compatibility View Through Code In IE?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 03:10:28
I for some reason am calling a doctype preferably XHTML 1.0 Transitional, and for some reason every single time I open it in Internet Explorer I get... Browser Mode: IE9 Compat View Document Mode: IE7 Standards I'll even include what my doctype looks like with the beginning of my head tags: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> And yes, I do close <body> and <html> . Any ideas? Sologoub Here's the documentation you are looking for: http://msdn.microsoft.com/en

websocket for binary transfer of data & decode

非 Y 不嫁゛ 提交于 2019-12-04 02:57:40
I was reading through the specification and many examples about usage of websockets. Almost all of them talk about UTF-8 or ascii message transfer using websockets. The latest Hybi websocket spec requested support for binary transfer. REQ 6 in hybi spec Also i read somewhere that chrome supports hybi. But latest release Chrome 7.0 works only when draft-hixie is selected in pywebsocket config. Does any browser have support for hybi spec? Even if it is dev, its ok. It may be a while before non-UTF-8 (i.e. binary) encoding is supported in WebSockets. I suggest using base64 encode/decode on the

Is it poor form to use CLASS attributes with no corresponding CSS rule? [duplicate]

假如想象 提交于 2019-12-04 02:54:03
问题 This question already has answers here : Can I use non existing CSS classes? (13 answers) Closed 5 years ago . For example if I wanted to select some elements with a certain class using jQuery, and for that reason only, is it always expected that those classes SHOULD be defined in the css?. <div class="xyz"> something </div> <div class="xyz"> something else </div> //with example jQuery $(".xyz").hide(); //is it wrong no element 'xyz' is defined in css? 回答1: Using CSS classes and - depending

Why can a variadic class template have at most one parameter pack?

孤街浪徒 提交于 2019-12-04 02:27:56
问题 There are moments when wish I could write a class template parameterized by a punctuated list of variadic template parameter packs, e.g. template<typename ...lhs, int Punct, typename ...rhs> struct tuple_pair { std::tuple<lhs...> _lhs; std::tuple<rhs...> _rhs; }; or for that matter: template<int ...lhs, typename Punct, int ...rhs> struct seq_pair { std::integer_sequence<int,lhs...> _lhs; std::integer_sequence<int,rhs...> _rhs; }; These may very well be moments when I am wishing for a grubby

Why does the default setting for `requestPathInvalidCharacters` exclude otherwise-allowed characters?

断了今生、忘了曾经 提交于 2019-12-04 02:12:48
In ASP.NET, the httpRuntime/@requestPathInvalidCharacters attribute defaults to <,>,*,%,&,:,\ . These characters, as I understand, are disallowed in the path portion of a URL (based on the default setting of this attribute), but some of them should be allowed. Out of that list, I struggle to understand why *,&,: are disallowed by default. E.g., the following URLs are valid but would be rejected by default by ASP.NET: To get a unique person by email: http://myservice.com/People/Email=jim@smith.net To get a unique locality within a state: http://myservice.com/States/VA/Localities/FIPS=001 I

What is “ANSI C++”?

无人久伴 提交于 2019-12-04 01:54:20
I've had someone tell me that C++98 was written under ANSI before being formally standardised as ISO/IEC 14882:1998. I know that ANSI was involved with C, but I can't seem to find much in the way of proof that the phrase "ANSI C++" is terribly accurate. Is "ANSI C++" a good description for C++98? Is "ANSI C++" a good description for subsequent versions of the C++ standard? Erik Initially, in '89, the standardization of C++ was handled by ANSI X3J16. Starting in '91 ISO WG21 joined in. You may want to read BS's A History of C++:1979-1991 . IMO, "ANSI C++" is just a leftover name; the language

Why is it bad to type void main() in C++ [duplicate]

与世无争的帅哥 提交于 2019-12-04 01:36:35
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Difference between void main and int main? Why is void main() { //return void } bad? The other day I typed this and someone pointed out to me that it is wrong to do so. I was so confused. I have been writing like this for a while now, I know it isn't C++ standard, but the compiler doesn't give out any warnings. Why is this wrong? 回答1: Because the compiler you use does not error out on it, it doesn't mean other

Portable way to achieve ls' -v flag (i.e. sort by version)?

被刻印的时光 ゝ 提交于 2019-12-04 01:34:32
问题 I'm working on a some build scripts that I'd like to depend on only standardized features. I need to sort some files by version. Say the files are bar-1.{0,2,3} bar-11.{0,2,3}. By default, ls gives me: bar-1_0 bar-11_0 bar-11_2 bar-11_3 bar-1_2 bar-1_3 Getting what I want is easy using 'ls -v': bar-1_0 bar-1_2 bar-1_3 bar-11_0 bar-11_2 bar-11_3 The problem is that 'ls -v' is not standard. Standard sort also seems to lack the option I want, though I could be looking at old versions of the