circular-reference

Undefined type error even with forward declaration

不问归期 提交于 2019-12-25 00:48:26
问题 I was reading up on circular references and forward declarations. I do understand that it is not a good design practice to have implementations in a header file. However I was experimenting and could not understand this behavior. With the following code (containing the forward declarations) I expected it to build, however I get this error: Error 1 error C2027: use of undefined type 'sample_ns::sample_class2' Header.hpp #ifndef HEADER_HPP #define HEADER_HPP #include "Header2.hpp" namespace

GraphQL [graphql js] circular dependencies: The type of * must be Output Type but got: [object Object]

夙愿已清 提交于 2019-12-24 23:43:51
问题 EDIT added my solution as an answer ORIGINAL QUESTION i believe this issue has to do with circular dependencies. i spent the better half of last night and today trying everything i could find online but nothing seems to work. what i have tried: convert the fields prop to a function that returns a field object convert the relating fields (within the fields prop) into functions that return the type combining the two approaches above finally ending with require statements in place of the fields

Circular Dependecies in C++ / Classes that dpend each other

十年热恋 提交于 2019-12-24 16:24:26
问题 i have the following problem: I have a Pawn, that stands on a Field. So I have the Class Pawn and the Class Field. I want to have access from the Field to the Pawn that stands on it, and I want to have access from the Pawn to the Field it stands on. So i have classes: class Pawn; class Player; class Field; class PlayerList; class Pawn { public: int intID; Player* plrPlayer; Field* fldField; ... int getPosition() { //gets the ID of the Field it stands on return fldField->intID; //Here i get

Java - Enums - Logical circular reference [duplicate]

我只是一个虾纸丫 提交于 2019-12-23 21:41:09
问题 This question already has answers here : Java enum- Cannot reference a field before it is defined (8 answers) Closed 3 years ago . Imagine the following made up example: public enum Hand { ROCK(SCISSORS), PAPER(ROCK), SCISSORS(PAPER); private final Hand beats; Hand(Hand beats) { this.beats = beats; } } I will get an error Illegal forward reference for forward referencing SCISSORS . Is there a way to handle such forward references in Java? Or how would you model such a situation, where you

Endless loop in a code sample on serialization

為{幸葍}努か 提交于 2019-12-23 09:27:07
问题 Have a look at the following code from here. It's about preserving circular references in a datacontract (object model, object graph, domain model) when serializing in wcf. class ReferencePreservingDataContractSerializerOperationBehavior :DataContractSerializerOperationBehavior { public ReferencePreservingDataContractSerializerOperationBehavior( OperationDescription operationDescription) : base(operationDescription) { } public override XmlObjectSerializer CreateSerializer( Type type, string

AngularJS TypeError: Converting circular structure to JSON at Object.stringify (native)

爷,独闯天下 提交于 2019-12-23 03:22:41
问题 I'm trying to get this piece of code working. Apparently, there is a circular reference in the code, but I can't find it. Can someone help me out? var appjson = '{\"APP_DATA_RETRIEVED\" : \"fail\"}'; var appPostRequest = $.get(appurl, data, appconfig); appPostRequest.done(function(appdata) { appjson = JSON.stringify(appdata); console.log(appjson); var postResponse = jQuery.parseJSON(appjson); var postResponse2 = postResponse.Response; var post = []; console.log(postResponse2.length); for (i=0

Preventing automatic population of circular navigation properties in Entity Framework

只愿长相守 提交于 2019-12-23 02:36:29
问题 I have a problem when retrieving entities which have a circular reference. My entity navigation properties are not lazy loaded, so I would expect them to return null unless specifically included in a query, however I've found that when there is a circular reference between two entities this isn't the case and instead a recursive hierarchy is returned. For example, let's say we have two entities UserEntity and PostEntity . A UserEntity may have many posts, but a post must only have a single

Saving Bundle with Android ComplexPreferences (JSon)

人走茶凉 提交于 2019-12-23 02:34:29
问题 This is a follow-on question from here: Save Bundle to SharedPreferences I am trying to use the ComplexPreferences class from the aforementioned thread to save a Bundle object in my Android app, but to no avail! Here is the code I'm using to save and load the data to ComplexPreferences (much the same as in the example on the download page for the ComplexPreferences class): Class1: save = ComplexPreferences.getComplexPreferences(this, SAVE, MODE_PRIVATE); ... Bundle gameState = new Bundle();

How can I pass `this` to a constructor without circular references (or losing type) in c++?

自作多情 提交于 2019-12-23 01:03:26
问题 EDIT: this has been marked as a duplicate. I believe there is a distinction between Q: what can I use to solve my problem, A: this thing ~and~ Q: what is this thing? A: big huge in depth answer. I'm not sure what the official ruling on this is though. I have two classes which both need to know about each other // Creator.h #pragma once #include "Creation.h" class Creator { Creator() { myThing = new Creation(*this); } int age = 42; Creation myThing*; } . // Creation.h #pragma once #include

Copying Excel's Circular Reference formula in PHP

馋奶兔 提交于 2019-12-22 11:35:52
问题 I am trying to copy an Excel's Circular Reference formula in PHP. In Excel I have: A19 = A25-A22 (result: 8771.65) A22 = A19*14.1% (result: 1236.80) A25 = 10000 But, it does not give me correct result when i try to compute it in PHP: $Tax = 0; $Gross = 0; $Net_Amount = 10000; $Gross = $Net_Amount - $Tax; $Tax = $Gross * (14.1/100); Any idea on how to do this in PHP? 回答1: By default, Excel will report a warning when you have a circular reference. The exception is if you have told it to handle