Skip to content

Instantly share code, notes, and snippets.

@kheaactua
Last active August 29, 2018 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kheaactua/251310d109dc80cd3a983824bd72d30c to your computer and use it in GitHub Desktop.
Save kheaactua/251310d109dc80cd3a983824bd72d30c to your computer and use it in GitHub Desktop.
#include <iostream>
#include <queue>
#include <boost/tti/has_member_function.hpp>
BOOST_TTI_HAS_MEMBER_FUNCTION(notify_exit)
template<typename Data>
class QueueB
{
public:
auto notify_exit() -> void;
};
template <typename Queue>
class MyQueue
{
public:
auto notify_exit() -> typename std::enable_if<
has_member_function_notify_exit<Queue, void>::value,
void
>::type;
Queue queue_a;
};
auto main(int argc, char *argv[]) -> int
{
MyQueue<std::queue<int>> queue_a;
std::cout << "std::queue has notify_exit? " << (has_member_function_notify_exit<std::queue<int>, void>::value ? "yes" : "no") << std::endl;
std::cout << "QueueB has notify_exit? " << (has_member_function_notify_exit<QueueB<int>, void>::value ? "yes" : "no") << std::endl;
}
/* vim: set ts=4 sw=4 sts=4 expandtab ffs=unix,dos : */
CXX = clang++
boost_base := ${HOME}/.conan/data/boost/1.60.0/ntc/stable/package/3de93f54463683a59d0674ac75727b8457727fc8
all:
${CXX} -o example -L${boost_base}/lib -I${boost_base}/include example.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment