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

405 questions
2
votes
1 answer

Should an explicit copy constructor be ignored?

Here is small example which demonstrates an unclear moment struct CL { CL(){} CL(int){} explicit CL(const CL&){} }; int main() { CL cl1; CL cl2=5; //(1) CL cl3=(CL)5; //(2) return 0; } The CL class have conversion…
Denis
  • 2,786
  • 1
  • 14
  • 29
2
votes
1 answer

Perl: Global Symbol Requires Explicit Package Name

So I've been attempting to find the solution to this but so far everything I've read online has to do with scope issues and not declaring the variables with the my keyword. However, I can't seem to fix the issues because I've declared everything at…
2
votes
2 answers

Explicit and non-explicit constructors

class Test { public: Test(int i) { cout<<"constructor called\n";} Test(const Test& t) { cout<<" copy constructor called\n";} }; class Test1 { public: Test1(int i) { cout<<"constructor…
2
votes
1 answer

Explicitly loading all navigation properties in a list of previously fetched objects in Entity Framework?

Suppose I have something like var remoteData = query.Where(s => ).ToArray(); and every object in the array has a navigation property called Department. Is there a way of explicitly loading all the Department properties in a single…
Para
  • 2,022
  • 5
  • 34
  • 73
2
votes
3 answers

Is mandatory explicit upcasting possible in C++

Suppose that A derives from B. Is there a way to forbid an implicit upcast like the one in B *x = new A() by making an explicit cast necessary, for example?
Xlea
  • 495
  • 1
  • 4
  • 14
2
votes
1 answer

Trying to push an element in to a vector

In a header file (which I haven't written), a struct has been defined like this struct MemoryMessage : public boost::counted_base { /*, public FastAlloc*/ explicit MemoryMessage(MemoryMessageType aType) : theType(aType) {} explicit…
mahmood
  • 23,197
  • 49
  • 147
  • 242
2
votes
1 answer

OpenCV in Visual Studio using C++ How to cut selected timing from a video file?

I have a 5 min mp4 video file. I want to cut in between from 2 min to 3 min. E.g. Video1.mp4 is 5 min long video, the output should be another file called Video2.mp4 that contain 2 min to 3 min from Video1.mp4. What do i need to edit from the code…
user3743939
  • 105
  • 2
  • 3
  • 13
2
votes
1 answer

explicit constructor in std::runtime_error

According to cplusplus.com, this is the implementation of the std::runtime_error class: class runtime_error : public exception { public: explicit runtime_error (const string& what_arg); }; Since the constructor is explicit, I expected it to only…
humodz
  • 600
  • 3
  • 8
2
votes
2 answers

Explicitly passing a const object to an constructor which takes const reference to a polymorphic class

I got into a problem with my classes, passing a const object (polymorphic structure) to an explicit constructor which takes a const reference to the base class of that polymorphic structure. Here is the sample (this is not from my code, it is for…
user265149
  • 199
  • 2
  • 8
2
votes
2 answers

C++ compiler can silently accept wrong conversion and introduce unpredictable errors

I have this simple code: class A { public: int m; }; class B : public A { public: B(const B& b) { /*...*/ } B(const A& a) { /*...*/ } int n; }; const A& function() { static A a; return a; } int main() { const B& a =…
user3123061
  • 757
  • 5
  • 14
2
votes
2 answers

How to wait for Grid execution spinner with Java Explicit WebDriver Wait

I have a grid in my page that been refreshed with variety of actions (reloading, sorting, filtering, etc). Every time one of the actions been applied spinner appears in front of grid until data in grid been reloaded. It may take from 300 to 3000 ms…
mbeider
  • 15
  • 4
2
votes
1 answer

Improving FOR XML Explicit Perfomance

Although using SQL FOR XML EXPLICIT is cumbersome, I find myself using it often. Since it allows full control over the generated XML document. My problem is with perfomance, sometimes it would take more than 5 minutes to generate an XML document…
A B
  • 343
  • 4
  • 9
2
votes
1 answer

Explicit integral could not be found

I am getting a well-known error of "Explicit integral could not be found" if I try to evaluate following integral syms z; funz=1./(1+exp((z*z-0.5)/0.1)); Integ2=int(funz,z,0,inf) I get the warning: Warning: Explicit integral could not be found. …
mantu pandey
  • 133
  • 5
  • 12
2
votes
1 answer

C++/CLI: Cannot explicitly implement interface member with different return type

Let's say we have two C++/CLI interfaces declaring Foo() members with different return type. public interface class InterfaceA { bool Foo(); }; public interface class InterfaceB { int Foo(); }; What we want to do here is to have a class…
edwabr123
  • 97
  • 9
2
votes
2 answers

Why I am not able to invoke 'explicit a (string x)'?

I am not able to Invoke 'explicit a (string x)' using the object a3, I got two compilation errors such as: [Error] invalid conversion from 'const char*' to 'int' [-fpermissive] [Error] initializing argument 1 of 'a::a(int)' [-fpermissive] …
uss
  • 1,271
  • 1
  • 13
  • 29