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
Questions tagged [explicit]
405 questions
24
votes
3 answers
Explicit copy constructor
I have extended std::string to fulfil my needs of having to write custom function build into string class called CustomString
I have defined constructors:
class CustomString : public std::string {
public:
explicit…

abumusamq
- 780
- 1
- 10
- 29
20
votes
5 answers
Android explicit intent with target component
Is it possible to fire explicit intent but not for an activity from my project but for activity in some other application.
I am sure of this code and I know it is running
Intent i=new Intent(this,MyActivity.class);
But is it possible to do…

Lukap
- 31,523
- 64
- 157
- 244
19
votes
2 answers
What changes to C++ made copy initialization work for class with explicit constructor?
Consider this code:
struct X{
explicit X(){}
explicit X(const X&){}
};
void foo(X a = X()){}
int main(){}
Using C++14 standard, both GCC 7.1 and clang 4.0 rejects the code, which is what I expected.
However, using C++17 (-std=c++1z), they…

WhiZTiM
- 21,207
- 4
- 43
- 68
19
votes
8 answers
Best (safest) way to convert from double to int
I'm curious as to the best way to convert a double to an int. Runtime safety is my primary concern here (it doesn't necessarily have to be the fastest method, but that would be my secondary concern). I've left a few options I can come up with…

Joel B
- 12,082
- 10
- 61
- 69
19
votes
1 answer
Why do we still need a .lib stub file when we've got the actual .dll implementation?
i'm wondering why linkers can not do their job simply by consulting the information in the actual .dll files that got the actual implementation code ? i mean why linkers still need .lib files to do implicit linking ?
are not the export and relative…

geeko
- 2,649
- 4
- 32
- 59
19
votes
2 answers
Incorrectly aligned or overlapped by a non-object field error
I'm trying to create the following structure:
[StructLayout(LayoutKind.Explicit, Size=14)]
public struct Message
{
[FieldOffset(0)]
public ushort X;
[FieldOffset(2)]
[MarshalAs(UnmanagedType.ByValArray,…

SwDevMan81
- 48,814
- 22
- 151
- 184
18
votes
5 answers
Explicitly Define Datatype in Python Function
I want to define 2 variables in python function and define them as float explicitly. However, when i tried to define them in the function parameter, it's showing syntax error.
Please help me get the desired output.
Here is the code:
def add(float…

Animikh Aich
- 598
- 1
- 6
- 15
17
votes
5 answers
Explicitly disabling UIView animation in iOS4+
I have been reading that Apple recommends to use block-based animations instead of CATransaction
Before, I was using this code to disable animations:
[CATransaction begin];
[CATransaction setDisableActions: YES];
// !!! resize
[CATransaction…

P i
- 29,020
- 36
- 159
- 267
17
votes
1 answer
Explicit cast operator fails with "assembly is not referenced" error
This is a very uncommon problem and there are definetly many workarounds, but I would like to understand what is actually going on and why it's not working.
So I have 3 assemblies in a test solution, first assembly has type ClassA:
public class…

Ilya Luzyanin
- 7,910
- 4
- 29
- 49
17
votes
6 answers
What variable name do you use for file descriptors?
A pretty silly trivial question. The canonical example is f = open('filename'), but
f is not very descriptive. After not looking at code in a while,
you can forget whether it means
"file" or "function f(x)" or "fourier
transform results" or…

endolith
- 25,479
- 34
- 128
- 192
16
votes
3 answers
How to calculate the explicit form of a recursive function?
I have this recursive function:
f(n) = 2 * f(n-1) + 3 * f(n-2) + 4
f(1) = 2
f(2) = 8
I know from experience that explicit form of it would be:
f(n) = 3 ^ n - 1 // pow(3, n) - 1
I wanna know if there's any way to prove that. I googled a bit, yet…

atoMerz
- 7,534
- 16
- 61
- 101
16
votes
4 answers
Need explanation difference between json and dict in Python
I am just curious to understand JSON and Dict in Python more deeply.
I have a JSON response from a server like this:
`{"city":"Mississauga","country":"Canada","countryCode":"CA"}`
And I want to work with it as a dictionary. For this, I use .json()…

user1542557
- 181
- 1
- 1
- 4
16
votes
5 answers
Why Can A C# Class Inherit From One Interface Both Implicitly and Explicitly?
Today I happens to find that one C# class can inherit one interface both in implicit and explicit way. This surprises me. If C# works in this way, then one instance can behave differently when referenced in different way.
interface IFoo
{
void…

Morgan Cheng
- 73,950
- 66
- 171
- 230
16
votes
1 answer
Why are function template specializations not allowed inside a class?
After having found answers to many of my questions on stackoverflow, I have now come up against a question of which I can't find the answer and I hope that someone is willing to help me!
My problem is that I want to do an explicit templatization of…

Malin
- 771
- 1
- 7
- 16
16
votes
1 answer
Why double parameter constructor begins with an explicit keyword?
My buddy and I have been recently reading leveldb source code. And we encounter this problem. In leveldb db/skiplist.h file, there is a constructor declaration:
explicit SkipList(Comparator cmp, Arena* arena);
I know explicit constructor with…

lulyon
- 6,707
- 7
- 32
- 49