explicit Questions
5
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...
Quidnunc asked 11/8, 2016 at 0:4
2
Solved
I recently came across some weird looking class that had three constructors:
class Class
{
public:
explicit Class(int );
Class(AnotherClass );
explicit Class(YetAnotherClass, AnotherClass );...
Ree asked 13/7, 2009 at 10:20
9
Solved
I'm new to C# and learning new words. I find it difficult to understand what's the meaning of these two words when it comes to programming c#.
I looked in the dictionary for the meaning and here's...
Fisticuffs asked 24/7, 2009 at 9:39
4
Solved
Here's the story. I created an interface, IVehicle. I explicitly implemented the interface in my class, Vehicle.cs.
Here is my interface:
Interface IVehicle
{
int getWheel();
}
here is my clas...
5
Solved
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 t...
Vipul asked 5/4, 2017 at 14:5
2
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...
Erotic asked 24/4, 2023 at 13:35
3
Solved
#include <iostream>
#include <string>
struct mystruct{
mystruct(std::string s){
std::cout<<__FUNCTION__ <<" String "<<s;
}
explicit mystruct(bool s)...
Vandiver asked 3/3, 2021 at 7:51
2
Solved
Is there a reason to use the explicit keyword for a constructor that doesn't take any arguments? Does it have any effect? I'm wondering because I just came across the line
explicit char_separ...
Ballyrag asked 21/7, 2011 at 11:32
3
Solved
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::strin...
Hammett asked 14/7, 2012 at 2:29
11
Solved
What does the explicit keyword mean in C++?
Conchiolin asked 23/9, 2008 at 13:58
5
Solved
I would like to have a clear and precise understanding of the difference between the two.
Also is the this keyword used to implicitly reference or explicitly ? This is also why I want clarificatio...
2
Solved
In this example, is it possible to allow the deduction of the template parameters type of the tuple?
#include<tuple>
#include<string>
template<class T1, class T2>
void fun(std::...
Timbering asked 23/5, 2013 at 0:39
2
Solved
I recently noticed a class in C++0x that calls for an explicit default constructor. However, I'm failing to come up with a scenario in which a default constructor can be called implicitly. It seems...
Cheek asked 14/5, 2010 at 19:16
5
I understand that constructors with one (non-default) parameter act like implicit convertors, which convert from that parameter type to the class type. However, explicit can be used to qualify any ...
Holiness asked 17/12, 2010 at 2:17
2
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...
Dobsonfly asked 24/5, 2017 at 9:24
3
C++20 introduced explicit (bool) which conditionally selects at compile-time whether a constructor is made explicit or not.
Below is an example which I found here.
struct foo {
// Specify non-i...
8
Solved
I know you can use C++ keyword 'explicit' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion of parameters for a class m...
Forsta asked 6/10, 2008 at 18:58
1
I thought Implicit linking loads a DLL as soon as the application starts because it is also called "load-time dynamic linking". But I found some strange explanations below from the link here(https:...
2
Solved
cppreference shows the following definition of std::in_place_t:
struct in_place_t {
explicit in_place_t() = default;
};
inline constexpr std::in_place_t in_place{};
Why have they added an expli...
Primordial asked 18/3, 2019 at 15:56
2
Solved
I have a class with 2 constructors.
explicit MyClass(size_t num);
template<class T> MyClass(T myObj);
And I want that whenever I make
MyClass obj( 30 );
The first constructor will be ...
Drill asked 17/12, 2012 at 10:8
2
Solved
I am learning C++ recently and I noticed an example on cppreference, part of which goes like this:
struct B
{
explicit B(int) { }
explicit operator bool() const { return true; }
};
int main()
{...
Logway asked 29/1, 2019 at 15:31
2
Solved
I am trying to create a global function template specialized for some given types. It looks something like that:
A.h (primary template, template specialization, extern)
template <typename T>...
Lactation asked 12/11, 2018 at 22:38
4
In the class below,
Why would you make the operators explicit. I thought that explicit was to prevent implicit calling of constructors?
class Content
{
public:
virtual ~Content() = 0;
virtu...
Electropositive asked 24/9, 2018 at 15:47
1
Solved
I am creating my own class for String using C++ solely for learning purposes.
And I stuck upon the place where I should make a decision. Let me explain the matter.
I have two options of my class....
Overblouse asked 20/9, 2018 at 18:31
1
Solved
First attempt and everything works fine:
class Base {
public:
Base() {std::cout << "default ctor!\n"; }
};
...
Base b{};
Base b_one = {};
Another way of implementation(add explicit):
cl...
Slit asked 15/8, 2018 at 15:51
1 Next >
© 2022 - 2024 — McMap. All rights reserved.