Questions tagged [explicit]

In C++ specifies constructors and conversion operators that don't allow implicit conversions or copy-initialization. In C# declares a user-defined type conversion operator that must be invoked with a cast. For MS SQL Server for-xml-EXPLICIT mode use the [for-xml-explicit] tag

Filter by
Sorted by
Tagged with
0 votes
0 answers
100 views

RNN fail with CUDA but runs on CPU

Problem with RNN and CUDA. I want to run a RNN (https://fluxml.ai/Flux.jl/stable/models/recurrence/) on the GPU, using the explicit (https://fluxml.ai/Flux.jl/stable/training/training/#Implicit-or-...
abj's user avatar
  • 3
0 votes
0 answers
34 views

how to control bezier animation?

i need similar animation like How to animate widget along a curved bezier path from start point to end point? but with the possibility to be able to stop/resume(control) the animation. How can i do ...
user3478472's user avatar
0 votes
0 answers
91 views

(Excel VBA selenium) How to reload a page if it is timeout? I have some codes

Set chkdata = New Selenium.ChromeDriver chkdata.Get "http://example.com" chkdata.Window.Maximize chkdata.FindElementByName("ctl00$PublicMasterPage").WaitDisplayed.Click Hi all, I ...
exe127's user avatar
  • 1
1 vote
1 answer
609 views

Android Studio - "Unable to find explicit activity class" and I have already declared the activities in Manifest, which is the suggested problem

This error comes up in the logcat when I try to click on a button in my application and it crashes: ``` FATAL EXCEPTION: main Process: com.example.savedtrial, PID: 16090 android.content....
Cruz's user avatar
  • 15
4 votes
1 answer
107 views

How does the 'explicit' keyword affect C++ copy constructors and function parameters?

The "explicit" keyword to modify the copy constructor can cause problems. Objects passed as function parameters are particularly susceptible to these issues. here are my codes: #include <...
Andrés's user avatar
  • 41
0 votes
0 answers
64 views

Calling a utility routine from a subroutine in Abaqus Explicit

I am writing a VUSDFLD that has a dependence on the incremental principal strain. I use vgetvrm to get the current strain tensor, but I fail to pass this to vsprinc to calculate the principal strains. ...
Ingrid's user avatar
  • 1
12 votes
2 answers
1k views

Why conversion function is not used for an object when it is assigned to?

I learned that we could provide conversion operators for our classes in C++. So I expected that for the following program, c=1; would've used the conversion operator int(). But to my surprise; that ...
Sam's user avatar
  • 166
0 votes
0 answers
76 views

Abaqus/Explicit with user subroutines: ERROR

When I type abaqus info=system into the abaqus command window, everything looks fine: C++ Compiler: Microsoft Visual C++ 14.29.30147.0 Linker Version: Microsoft (R) Incremental Linker ...
Cosima's user avatar
  • 1
0 votes
5 answers
151 views

Hello I am trying to display "5 + 5 = 10" with the syntax as follows print ("2 + 2 = " + ( 2 + 2) )

I am trying to display "5 + 5 = 10" with the syntax as follows print ("2 + 2 = " + ( 2 + 2) ), what is the correct syntax to write it as i keep getting the error : " TypeError:...
Tech_br0's user avatar
1 vote
1 answer
134 views

Multiple explicit constructors and implicit conversion

I have a class like this: class Foo { private: std::string m_data; public: Foo() = default; explicit Foo(double value); explicit Foo(float value); ...
HeapOverflow's user avatar
2 votes
1 answer
132 views

Program with explicit works in msvc but not in gcc

I learnt about the explicit keyword in c++ and its uses. Then for practice I wrote the following program that works with MSVC but not with gcc and clang. Demo. class Testing { public: ...
Alex's user avatar
  • 318
0 votes
1 answer
116 views

JToken.explicit operator bool cannot call operator or accessor directly

if (JToken.op_Explicit(apiConfig["finjVersion"]) < JToken.op_Explicit(latestData["finjVersion"])) { ... } Error: JToken.explicit operator bool(JToken)': cannot call operator ...
umurew's user avatar
  • 13
0 votes
1 answer
486 views

"System.FormatException: Input string was not in a correct format."

"System.FormatException: Input string was not in a correct format." This keeps stopping my program and telling me that I have not converted the user input to an integer (because user input ...
Content Deleted's user avatar
0 votes
1 answer
93 views

Handling null in custom cast operator

I am trying to add a cast from a class to a struct. In my concrete case, the to-be-casted source type would be class MacAddress, a class used for string-input validation of the various typical 6-byte-...
LWChris's user avatar
  • 3,410
0 votes
1 answer
110 views

Why adding `explicit` to a defaulted copy constructor prevents returning an object? [duplicate]

Considering this MRE (the real case involves some class with some inheritance and some member variables) class A { public: A() = default; explicit A(const A&) = default; // ...
Antonio's user avatar
  • 19.6k
1 vote
1 answer
54 views

stale element refernce issue and dom refreshing via explicit/implicit waits

I had an issue which I was able to resolve with explicit wait. My curiosity comes, what goes inside selenium webdriver that when I used implicitly wait for 300 seconds, it did continue to give stale ...
xlmaster's user avatar
  • 679
0 votes
0 answers
44 views

Problems with explicit constructor calls [duplicate]

When we call constructor explicitly then destructor also get called explicitly, so i tried deleting some dynamically allocated variable when destructor is called after putting it in a variable. But ...
Aditya Patel's user avatar
2 votes
1 answer
55 views

Explicit copy constructor of a parameter passed via std::async

In the following program foo function is executed asynchronously and its argument of type A is copied inside async by value: #include <future> struct A { A() = default; explicit A(const ...
Fedor's user avatar
  • 17.7k
1 vote
1 answer
285 views

When you create a new class based on QObject, why does the wizard mark your constructor explicit?

I have never really paid attention to explicit, and I am not terribly sure what to infer from it when I find it in a class header. Looking through my code, I noticed that in QtCreator, when you create ...
Anon's user avatar
  • 2,345
3 votes
1 answer
110 views

Why here template Vector3<int> cannot convert to Vector3<int>?

It seems quite weird. Here you can see the error message is that a convert happens between one type and it fails. If I remove the explicit modifier from Vector3's copy constructor it is fine, no error....
Young_cun_yi_ba's user avatar
2 votes
1 answer
423 views

How is that an explicit constructor is used in an implicit conversion [duplicate]

I am learning about explicit keyword in C++ using the resources listed here and as this post says: Prefixing the explicit keyword to the constructor prevents the compiler from using that constructor ...
Kal's user avatar
  • 475
1 vote
2 answers
79 views

Why not checking the explicitness of a constructor when matching it?

The following behavior is rather strange to me: class Y { public: Y(int) { cout << "Y\n"; } }; class X { public: X(int, const Y&) { cout << "int, const Y&\n&...
CPPL's user avatar
  • 726
0 votes
1 answer
123 views

Adding an explicit constructor makes a construction fail

I would like to understand how the compiler is selecting constructor in the following situation class Y { public: Y(int) {} }; class X { public: X(int, int, Y) { cout << "Y\n";...
CPPL's user avatar
  • 726
1 vote
2 answers
2k views

How to open both WhatsApp and GB-Whatsapp using an Intent in your Android App

I want to open chooser for both whatsapp and gb-whatsapp so the user can choose any of one from them. This code is only opening whatsapp only. Intent intentWhatsapp = new Intent(Intent.ACTION_VIEW); ...
Tariq Mahmood's user avatar
4 votes
1 answer
257 views

Why does shared_ptr<int> p; p=nullptr; compile?

Since the constructor of std::shared_ptr is marked as explicit one, so expressions like auto p = std::make_shared<int>(1); p = new int(6); is wrong. My question is why does std::make_shared<...
John's user avatar
  • 3,085
0 votes
1 answer
538 views

Default initialization explicit constructor c++

How does default initialization work in C++11 if the default constructor is explicit? For example: #include <iostream> struct Foo { int x; explicit Foo(int y = 7) : x{y} {} } int main() { ...
Daniel Ricketts's user avatar
0 votes
1 answer
93 views

Why is converting constructor of std::packaged_task explicit?

Why is the converting constructor of std::packaged_task explicit, while the same constructor of std::function is not? I cannot find any reasoning for it. This, for example, forces casting when passing ...
Daniel Langr's user avatar
  • 22.5k
1 vote
1 answer
116 views

A way to check if is_explicitly_constructible

I am looking for a way to implement such a trait: template <typename T, typename... Args> struct is_explicitly_constructible { static inline constexpr bool value = // implementation }; ...
marinno's user avatar
  • 11
0 votes
2 answers
686 views

I am trying to declare explicit wait in my constructor, but getting error incompatible types. How to solve it. Question related to selenium wait

package PageObject; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org....
Alka's user avatar
  • 23
1 vote
1 answer
434 views

Can't created a boost::shared_ptr from this

Say I have the following abstract Class A. Now I'm trying to create a shared_ptr to A from inside Class A. So in A i have the following function: class A { void A::setupArguments() const { ...
Lew Wei Hao's user avatar
0 votes
2 answers
1k views

C# Options to explicitly cast an object as a string

I am a relative newbie to C# as most of my web development work has been in VB. In VB something like a DataRow Object or Session Object will implicitly cast to say a string. I can say: If myDataRow(&...
Jon.A's user avatar
  • 13
0 votes
1 answer
326 views

Including a class requiring a input argument to its constructor in another class

I have a third party libary which defines a class as follows class ClassA{ public: explicit(std::string token) : _token(token); inline const std::string& getToken() const{ ...
afp_2008's user avatar
  • 2,061
0 votes
0 answers
26 views

Cpp class constructor explicit in the code [duplicate]

0 class a{ 1 public: 2 explicit a(int value=0) 3 : storedvalue{value}{} 4 int read() const 5 {return storedvalue; 6 } 7 private: 8 int storedvalue; 9 }; 1)Can anyone explain what ...
venki's user avatar
  • 1
0 votes
1 answer
141 views

Implicit Intent or Explicit Intent in Android

This intent : Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.youtube"); is Implicit or Explicit Intent ?
amine 's user avatar
0 votes
1 answer
255 views

Use assignment operators instead of an implicit constructor

In my program, I am trying to use the assignment operator= to assign an object of my class. I am specifically trying to call the assignment operator instead of an implicit constructor (thus the ...
jakob's user avatar
  • 157
-1 votes
1 answer
607 views

Waiting for a value to be greater than or equal to a certain number in Python Selenium

i'm trying to make a program that waits for a certain value to be greater than or equal to a certain number and then do some actions. PATH = "C:\Program Files (x86)\chromedriver.exe" driver =...
neto's user avatar
  • 19
0 votes
0 answers
15 views

Why implicit constructor with one parameter prints the last value, if multiple values are passed during object creation? [duplicate]

I have a class 'Entity'. It has a user-defined constructor (implicit) with one argument as shown below. class Entity { public: Entity(int a) { std::cout << a << std::endl; ...
pkthapa's user avatar
  • 1,039
-1 votes
1 answer
156 views

Explicit wait get bypassed without error Selenium Python

I'm trying to make a bot that logs inside my account. After inserting psw and username I make my bot clicking on "I'm not a robot" recaptcha checkbox. After flagging the Recaptcha checkbox ...
neto's user avatar
  • 19
0 votes
2 answers
28 views

Multiplication Explicit Casting not working C

long long int calculateUnits(int tokenVal, int billVal, int numOfTokens, int numOfBills) { long long int units; // tokenUnits = billVal * numOfTokens; // billUnits = tokenVal * numOfBills;...
EniGzz's user avatar
  • 7
15 votes
3 answers
1k views

Why const char* implicitly converted to bool rather than std::string?

#include <iostream> #include <string> struct mystruct{ mystruct(std::string s){ std::cout<<__FUNCTION__ <<" String "<<s; } ...
TruthSeeker's user avatar
  • 1,569
0 votes
1 answer
496 views

Is there a way for the typescript compiler to throw an error when using the "any" type explicitly? [duplicate]

I am trying to make my code as strict as possible with TS. Is there a way to make the following declaration using "any" as a type to throw an error since it should be a "string" ...
Ryan Santos's user avatar
0 votes
0 answers
77 views

Explicit Forward-Difference Method in Fortran Programming(Gives Overflow)-(what inputs should be given)

Question Link-(https://drive.google.com/file/d/1A9Vf-e1qbdNZxa_UQ2cy8K4LiEfubU6X/view?usp=sharing) The problem is with inputs when I give the inputs it gives me overflow error Code That is written for ...
Nakib Rahaman's user avatar
1 vote
0 answers
304 views

Does it make sense to declare explicit a private class constructor?

The title says it all, I'll provide some context though. I'm trying to create an iterator for my Dictionary class and I've decided not to nest one inside the other. Therefore the iterator constructors ...
Eligum's user avatar
  • 27
1 vote
1 answer
465 views

can't compile struct with std::atomic member with explicit instantiation

I am exploring the use of std::atomic in a struct across translation units and have run into a constructor compile problem. When I try to use explicit instantiation, the compiler says they don't match....
rtischer8277's user avatar
3 votes
2 answers
1k views

C++ use of explicit suggested by cppcheck

Is using the cast constructor bad? Otherweise why a code quality checker (cppcheck in my case) would constantly suggest to add explicit before single parameter constructors? What if I want to do class ...
DDS's user avatar
  • 2,397
0 votes
1 answer
34 views

When to cast a variable

Casting in Apex seems like Black Magic to me. I don't get when should we make an explicit cast, and when it can be implicit. Like: Recipe.apxc public virtual class Recipe{ public string nome; ...
Luis Aguiar's user avatar
0 votes
0 answers
206 views

Explicit up casting & Implicit up casting [duplicate]

I'm trying to find the difference between Explicit up casting and Implicit up casting but there's not so much posts about them. Somebody help me pls?
Nam Trần Đình's user avatar
3 votes
2 answers
173 views

Why doesn't the `explicit` keyword prevent a `char` from being converted into an `int`?

From what I understand, in the following code, explicit A(int a) should prevent A b('g'); to use the int constructor: #include <iostream> class A { public: int x; char *y; ...
H-005's user avatar
  • 487
3 votes
2 answers
163 views

What actually happens when copy initializing in C++?

Consider the following code: #include<iostream> using namespace std; class A{ public: A()=default; A(int a){cout<<"A(int) called"<<endl;} A(const A&a); ~A(){...
sakugawa's user avatar
  • 117
1 vote
1 answer
711 views

error: bool' cannot be declared with 'explicit' specifier

When I use the explicit with bool to convert a parameter I get this error: error C2178: 'sdds::Ship::operator bool' cannot be declared with 'explicit' specifier. My objective with this function was ...
OneWithCodess's user avatar

1
2 3 4 5
9