Boost logo

Boost :

Subject: [boost] How can I detect if a template static member function exists?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2016-10-16 07:16:19


I'd like to write a trait:

template<class T>
struct has_content_length :
  std::integral_constant<bool, ...>{};

which detects whether or not a template static member function is
present in T. Here's a typical T:

struct X
{
  template<bool isRequest, class Body, class Headers>
  static
  std::uint64_t
  content_length(
    message<isRequest, Body, Headers> const& m);
};

How can I detect if X::content_length(m) is callable for any m of type
message template?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk