Skip to content

Commit

Permalink
Make Fruit compile undr MSVC 2015. It still crashes at runtime, thoug…
Browse files Browse the repository at this point in the history
…h (for reasons unknown).
  • Loading branch information
poletti-marco committed Sep 3, 2017
1 parent ec29699 commit 8d00ef4
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 86 deletions.
4 changes: 2 additions & 2 deletions include/fruit/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,9 @@ class PartialComponent {
* injector for getBarComponentWithFakeDependency it would not install getFakeDependencyComponent.
*/
template <typename... OtherComponentParams, typename... FormalArgs, typename... Args>
PartialComponentWithReplacementInProgress<fruit::Component<OtherComponentParams...>, FormalArgs...> replace(
auto replace(
fruit::Component<OtherComponentParams...>(*)(FormalArgs...),
Args&&... args);
Args&&... args) -> PartialComponentWithReplacementInProgress<fruit::Component<OtherComponentParams...>, FormalArgs...>;

~PartialComponent();

Expand Down
4 changes: 2 additions & 2 deletions include/fruit/impl/component.defn.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ PartialComponent<Bindings...>::install(fruit::Component<OtherComponentParams...>

template <typename... Bindings>
template <typename... OtherComponentParams, typename... FormalArgs, typename... Args>
inline PartialComponent<Bindings...>::PartialComponentWithReplacementInProgress<fruit::Component<OtherComponentParams...>, FormalArgs...>
PartialComponent<Bindings...>::replace(fruit::Component<OtherComponentParams...>(*getReplacedComponent)(FormalArgs...), Args&&... args) {
inline auto
PartialComponent<Bindings...>::replace(fruit::Component<OtherComponentParams...>(*getReplacedComponent)(FormalArgs...), Args&&... args) -> PartialComponentWithReplacementInProgress<fruit::Component<OtherComponentParams...>, FormalArgs...>{
using IntCollector = int[];
(void)IntCollector{0, checkAcceptableComponentInstallArg<FormalArgs>()...};

Expand Down
8 changes: 4 additions & 4 deletions include/fruit/impl/component_functors.defn.h
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ struct AutoRegisterFactoryHelper {
void operator()(FixedSizeVector<ComponentStorageEntry>& entries) {
using NakedC = UnwrapType<Eval<C>>;
auto provider = [](const UnwrapType<Eval<CFunctor>>& fun) {
return UnwrapType<Eval<IFunctor>>([=](UnwrapType<Args>... args) {
return UnwrapType<Eval<IFunctor>>([=](typename Args::type... args) {
NakedC* c = fun(args...).release();
NakedI* i = static_cast<NakedI*>(c);
return std::unique_ptr<NakedI>(i);
Expand All @@ -967,7 +967,7 @@ struct AutoRegisterFactoryHelper {
#ifdef FRUIT_EXTRA_DEBUG
using NakedC = UnwrapType<Eval<C>>;
auto provider = [](const UnwrapType<Eval<CFunctor>>& fun) {
return UnwrapType<Eval<IFunctor>>([=](UnwrapType<Args>... args) {
return UnwrapType<Eval<IFunctor>>([=](typename Args::type... args) {
NakedC* c = fun(args...).release();
NakedI* i = static_cast<NakedI*>(c);
return std::unique_ptr<NakedI>(i);
Expand Down Expand Up @@ -1014,7 +1014,7 @@ struct AutoRegisterFactoryHelper {
using Result = Eval<GetResult(R)>;
void operator()(FixedSizeVector<ComponentStorageEntry>& entries) {
auto provider = [](const UnwrapType<Eval<CFunctor>>& fun) {
return UnwrapType<Eval<CUniquePtrFunctor>>([=](UnwrapType<Args>... args) {
return UnwrapType<Eval<CUniquePtrFunctor>>([=](typename Args::type... args) {
NakedC* c = new NakedC(fun(args...));
return std::unique_ptr<NakedC>(c);
});
Expand All @@ -1028,7 +1028,7 @@ struct AutoRegisterFactoryHelper {
std::size_t numEntries() {
#ifdef FRUIT_EXTRA_DEBUG
auto provider = [](const UnwrapType<Eval<CFunctor>>& fun) {
return UnwrapType<Eval<CUniquePtrFunctor>>([=](UnwrapType<Args>... args) {
return UnwrapType<Eval<CUniquePtrFunctor>>([=](typename Args::type... args) {
NakedC* c = new NakedC(fun(args...));
return std::unique_ptr<NakedC>(c);
});
Expand Down
4 changes: 2 additions & 2 deletions include/fruit/impl/injector.defn.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ inline Injector<P...>::Injector(const NormalizedComponent<NormalizedComponentPar

template <typename... P>
template <typename T>
inline Injector<P...>::RemoveAnnotations<T> Injector<P...>::get() {
inline typename Injector<P...>::RemoveAnnotations<T>::type Injector<P...>::get() {

using E = typename fruit::impl::meta::InjectorImplHelper<P...>::template CheckGet<T>::type;
(void)typename fruit::impl::meta::CheckIfError<E>::type();
Expand All @@ -136,7 +136,7 @@ inline Injector<P...>::operator T() {
template <typename... P>
template <typename AnnotatedC>
inline const std::vector<
typename fruit::Injector<P...>::template RemoveAnnotationsHelper<AnnotatedC>::type
typename fruit::Injector<P...>::template RemoveAnnotations<AnnotatedC>::type
*>& Injector<P...>::getMultibindings() {

using Op = fruit::impl::meta::Eval<
Expand Down

0 comments on commit 8d00ef4

Please sign in to comment.