¡@

Home 

c++ Programming Glossary: sfinae

How to detect whether there is a specific member variable in class?

http://stackoverflow.com/questions/1005476/how-to-detect-whether-there-is-a-specific-member-variable-in-class

this question Another way is this one which relies on SFINAE for expressions too. If the name lookup results in ambiguity..

SFINAE to check for inherited member functions

http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions

to check for inherited member functions Using SFINAE i can.. to check for inherited member functions Using SFINAE i can detect wether a given class has a certain member function...

Is it possible to write a C++ template to check for a function's existence?

http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence

templates sfinae share improve this question Yes with SFINAE you can check if a given class does provide a certain method... struct Hello int helloworld return 0 struct Generic SFINAE test template typename T class has_helloworld typedef char one..

How can I add reflection to a C++ application?

http://stackoverflow.com/questions/41453/how-can-i-add-reflection-to-a-c-application

checking whether a certain nested type exists use plain SFINAE . If you are rather looking for ways to accomplish 1 like looking..

Pretty-print C++ STL containers

http://stackoverflow.com/questions/4850473/pretty-print-c-stl-containers

answer from Sven Groot which combined with a bit of SFINAE type traiting appears to solve the problem in a completely general.. typename TAllocator class set namespace pretty_print SFINAE type trait to detect a container based on whether T const_iterator..

Polymorphism in c++

http://stackoverflow.com/questions/5854581/polymorphism-in-c

be derived from the same base class virtual dispatch 1 SFINAE effectively allows several sets of expectations. For example.. classes is preferable to fat interfaces failing at runtime SFINAE CRTP optimisations many including inlining and dead code elimination..

Isn't the template argument (the signature) of std::function part of its type?

http://stackoverflow.com/questions/5931214/isnt-the-template-argument-the-signature-of-stdfunction-part-of-its-type

_Is_integral _Fx value int _Type 0 Ignoring the SFINAE part it is constructible from pretty much anything. std boost.. Another option I consider but immediatly discarded was SFINAE which would introduce even more boilerplate code than the TMP..

how to provide a swap function for my class?

http://stackoverflow.com/questions/6380862/how-to-provide-a-swap-function-for-my-class

swap in STL algorithms 1 Member swap . Does std swap use SFINAE trick to use the member swap . 2 Free standing swap in the same.. lookup on swap . Also this has nothing to do with SFINAE. some algorithm in your code template class T void foo T lhs..

What breaking changes are introduced in C++11?

http://stackoverflow.com/questions/6399615/what-breaking-changes-are-introduced-in-c11

invalid in C 0x Such sizeof tricks have been used by some SFINAE and needs to be changed now User declared destructors have an..

std::enable_if to conditionally compile a member function

http://stackoverflow.com/questions/6972368/stdenable-if-to-conditionally-compile-a-member-function

parameter is true. But why doesn't g consider this as SFINAE I think that the overloading error message comes from the problem.. c templates g c 11 share improve this question SFINAE only works if substitution in argument deduction of a template.. argument deduction for their template arguments happen and SFINAE happens as expected. See this question and the corresponding..

Check if a class has a member function of a given signature

http://stackoverflow.com/questions/87372/check-if-a-class-has-a-member-function-of-a-given-signature

not sure if I understand you correctly but you may exploit SFINAE to detect function presence at compile time. Example from my.. template typename U size_t U const struct SFINAE template typename U static char Test SFINAE U U used_memory.. U const struct SFINAE template typename U static char Test SFINAE U U used_memory template typename U static int Test ... static..

How to detect whether there is a specific member variable in class?

http://stackoverflow.com/questions/1005476/how-to-detect-whether-there-is-a-specific-member-variable-in-class

classes with unknown members. c visual studio templates g sfinae share improve this question Another way is this one which..

Why to avoid std::enable_if in function signatures

http://stackoverflow.com/questions/14600201/why-to-avoid-stdenable-if-in-function-signatures

member and non member function templates c templates c 11 sfinae enable if share improve this question Put the hack in the..

SFINAE to check for inherited member functions

http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions

inherited member functions c templates metaprogramming sfinae share improve this question Take a look at this thread http..

Is it possible to write a C++ template to check for a function's existence?

http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence

know how to do is the FUNCTION_EXISTS part. c templates sfinae share improve this question Yes with SFINAE you can check..

Is there a way to test whether a C++ class has a default constructor (other than compiler-provided type traits)?

http://stackoverflow.com/questions/2733377/is-there-a-way-to-test-whether-a-c-class-has-a-default-constructor-other-than

int x class receive_size template class U static int sfinae receive_size sizeof U template class U static char sfinae ..... sfinae receive_size sizeof U template class U static char sfinae ... public enum value sizeof sfinae T 0 sizeof int class q q.. class U static char sfinae ... public enum value sizeof sfinae T 0 sizeof int class q q class r r int #include iostream using..

If the address of a function can not be resolved during deduction, is it SFINAE or a compiler error?

http://stackoverflow.com/questions/2892087/if-the-address-of-a-function-can-not-be-resolved-during-deduction-is-it-sfinae

to be defined a little better Thanks c templates c 11 sfinae overload resolution share improve this question template..

Explain C++ SFINAE to a non-C++ programmer

http://stackoverflow.com/questions/3407633/explain-c-sfinae-to-a-non-c-programmer

does SFINAE correspond to c programming languages c faq sfinae share improve this question Warning this is a really long.. less intact from http stackoverflow.com questions 2127693 sfinae sizeof detect if expression compiles template class T T ref..

How can I add reflection to a C++ application?

http://stackoverflow.com/questions/41453/how-can-i-add-reflection-to-a-c-application

could supply this information c reflection templates sfinae share improve this question There are two kinds of reflection..

SFINAE with invalid function-type or array-type parameters?

http://stackoverflow.com/questions/822059/sfinae-with-invalid-function-type-or-array-type-parameters

work and reject the first overload. c arrays templates sfinae share improve this question A small note although very rare..

Check if a class has a member function of a given signature

http://stackoverflow.com/questions/87372/check-if-a-class-has-a-member-function-of-a-given-signature

It's a bit more tricky. c templates design c 11 sfinae share improve this question I'm not sure if I understand..

Can SFINAE detect private access violations?

http://stackoverflow.com/questions/8984013/can-sfinae-detect-private-access-violations

some member of a class and the member is private what will sfinae respond Will it error out hard or will it say ok or will it.. out hard or will it say ok or will it error out in the sfinae way c language lawyer sfinae share improve this question.. or will it error out in the sfinae way c language lawyer sfinae share improve this question Yes. EDIT C 11 Standard quote..

Checking a member exists, possibly in a base class, C++11 version

http://stackoverflow.com/questions/9530928/checking-a-member-exists-possibly-in-a-base-class-c11-version

Yes No no 2 template typename T typename I void T I struct sfinae template typename T static No check ... template typename T.. T static No check ... template typename T static Yes check sfinae T int T reserve template typename T static Yes check sfinae.. T int T reserve template typename T static Yes check sfinae T size_t T reserve public static const bool value sizeof check..

C++ SFINAE examples?

http://stackoverflow.com/questions/982808/c-sfinae-examples

show me a good use for SFINAE c templates metaprogramming sfinae share improve this question Heres one example from here..