Git Product home page Git Product logo

Comments (4)

digibob avatar digibob commented on September 23, 2024

There are definitely some issues with the way in which the headers are set up right now, but we do make use of Clang in-house and I haven't seen the issue you have raised. Would it be possible for you to provide an example of your usage that is cause this error to show up?

from future-extensions.

impguard avatar impguard commented on September 23, 2024

Hmm, here's some pseudocode of essentially how we use it atm:

#include "ExpectedFuture.h"

SD::TExpectedFuture<TCustomHttpResponse<FHttpResponsePtr>> FCustomHttpRequest::Send()
{
	TSharedPtr<SD::TExpectedPromise<TCustomHttpResponse<FHttpResponsePtr>>> Promise =
		MakeShared<SD::TExpectedPromise<TCustomHttpResponse<FHttpResponsePtr>>>();

	FCustomOnRequestSuccess OnSuccess;
	OnSuccess.AddLambda([Promise](const FHttpResponsePtr Response)
	{
	        // TCustomHttpResponse can be built from a response or a standard error
		Promise->SetValue(Response);
	});

	FCustomOnRequestError OnError;
	OnError.AddLambda([Promise](const FStandardError& Error)
	{
		// TCustomHttpResponse can be built from a response or a standard error
		Promise->SetValue(Error);
	});

        // Essentially sends an HTTP Request
	Send(OnSuccess, OnError);

	return Promise->GetFuture();
}

I don't think there's anything particularly fancy. For what it's worth, our changes we've made to the library so far are:

// In FutureExtensionsTypeTraits.h
// Copyright(c) Splash Damage. All rights reserved.
#pragma once

#include "Templates/IntegralConstant.h"
#include "Runtime/Launch/Resources/Version.h"
// <Modification> Included ExpectedResult.h header to avoid implicit template instantiation clang compile error
#include "ExpectedResult.h"
// </Modification>

This seems to resolve the issue.

from future-extensions.

digibob avatar digibob commented on September 23, 2024

The library currently expects that you bring it in with
#include "FutureExtensions.h"
rather than any of the other headers - this is on my TODO list to investigate properly, but has been low priority.
Doing that should remove the need to modify any of the files.

A small note of the code above too - you don't need to MakeShared the promise, as it is internally just a wrapper around a shared pointer itself - copying the promise will still refer to the same object, so it will still be safe to capture by value in the lambdas, though you may need to mark them as mutable.

from future-extensions.

impguard avatar impguard commented on September 23, 2024

Awesome! Thanks for the info. That did indeed fix things. I didn't really check for a wrapper header. My bad! Thanks!

from future-extensions.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.