Skip to content

Commit

Permalink
msvc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cstratopoulos committed May 31, 2019
1 parent 48926df commit 4b746e0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,8 @@ else()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(REMOVE_ITEM files
${FOLLY_DIR}/Poly.cpp
${FOLLY_DIR}/Subprocess.cpp
)
list(REMOVE_ITEM hfiles
${FOLLY_DIR}/Poly.h
${FOLLY_DIR}/Poly-inl.h
${FOLLY_DIR}/detail/PolyDetail.h
${FOLLY_DIR}/detail/TypeList.h
${FOLLY_DIR}/poly/Nullable.h
${FOLLY_DIR}/poly/Regular.h
)
endif()

set(PCLMUL_FILES
Expand Down
2 changes: 1 addition & 1 deletion folly/Poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ using PolySelf = decltype(Access::template self_<Node, Tfx>());
*/
using PolyDecay = detail::MetaQuote<std::decay_t>;

#if !defined(__cpp_template_auto)
#if !FOLLY_NTTP_AUTO

/**
* Use `FOLLY_POLY_MEMBERS(MEMS...)` on pre-C++17 compilers to specify a
Expand Down
22 changes: 17 additions & 5 deletions folly/detail/PolyDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@

#include <folly/PolyException.h>

#if defined(__cpp_template_auto) || defined(__cpp_nontype_template_parameter_auto)
#define FOLLY_NTTP_AUTO 1
#else
#define FOLLY_NTTP_AUTO 0
#endif

namespace folly {
/// \cond
namespace detail {
Expand Down Expand Up @@ -66,7 +72,7 @@ detail::AddCvrefOf<T, I>& poly_cast(detail::PolyRoot<I>&);
template <class T, class I>
detail::AddCvrefOf<T, I> const& poly_cast(detail::PolyRoot<I> const&);

#if !defined(__cpp_template_auto)
#if !FOLLY_NTTP_AUTO
#define FOLLY_AUTO class
template <class... Ts>
using PolyMembers = detail::TypeList<Ts...>;
Expand Down Expand Up @@ -233,7 +239,7 @@ using MembersOf = typename I::template Members<remove_cvref_t<T>>;
template <class I, class T>
using InterfaceOf = typename I::template Interface<T>;

#if !defined(__cpp_template_auto)
#if !FOLLY_NTTP_AUTO
template <class T, T V>
using Member = std::integral_constant<T, V>;

Expand Down Expand Up @@ -668,14 +674,20 @@ struct BasePtr {
VTable<I> const* vptr_;
};

template <class I, class T, std::enable_if_t<inSitu<T>(), int> = 0>
constexpr void* (*getOps() noexcept)(Op, Data*, void*) {
template <class I, class T>
constexpr void* (*getOpsImpl(std::true_type) noexcept)(Op, Data*, void*) {
return &execInSitu<I, T>;
}


template <class I, class T>
constexpr void* (*getOpsImpl(std::false_type) noexcept)(Op, Data*, void*) {
return &execOnHeap<I, T>;
}

template <class I, class T, std::enable_if_t<!inSitu<T>(), int> = 0>
constexpr void* (*getOps() noexcept)(Op, Data*, void*) {
return &execOnHeap<I, T>;
return getOpsImpl<I, T>(std::bool_constant<inSitu<T>()>{});
}

template <class I, FOLLY_AUTO... Arch, class... S>
Expand Down
2 changes: 1 addition & 1 deletion folly/detail/TypeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ using If = MetaApply<impl::If_<If_>, Then, Else>;
*/
template <template <class...> class C, class... Ts>
class MetaDefer {
template <template <class...> class D = C, class = D<Ts...>>
template <class = C<Ts...>>
static char (&try_(int))[1];
static char (&try_(long))[2];
struct Result {
Expand Down

0 comments on commit 4b746e0

Please sign in to comment.