hello, I have this snippet of the code:
void addLineRelative(LineNumber number, LineNumber relativeNumber) {
list<shared_ptr<Line> >::iterator i;
findLine(i, number);
if(i == listOfLines.end()){
throw "LineDoesNotExist";
}
line 15 if(dynamic_cast<shared_ptr<FamilyLine>...
I'm trying to learn C from a Ruby/PHP/Java background, and I've found that you almost always explicitly cast things (at least in tutorials). Like, I always see things like
double x, y;
x = 1.0;
/*...*/
y = x*5.0;
However, it seems that on my Mac's version of GCC, automatic casting works.
Is leaving the .0 on things just a matter of ...
Hello there, i have very low C++ experiences and i need little help in casting a type.
I actually in a big dependence for that cast, need it rly hard.
So ...
I have this types :
typedef short DCTELEM;
typedef DCTELEM DCTBLOCK[64];
Array of last type and a pointer to a malloc'ed array of shorts:
DCTBLOCK MQUAD;
short * ptrArray;
...
I have the following enum
public enum TESTENUM
{
Value1 = 1,
Value2 = 2
}
I then want to use this to compare to an integer variable that I have, like this:
if ( myValue == TESTENUM.Value1 )
{
}
But in order to do this test I have to cast the enum as follows (or presumably declare the integer as type enum):
if ( myValue == ...
Hello, I've found it very weird that simple code like this is not valid:
select * from table where field=true
The alternative apparently being
select * from table where field='true'
Ok, guess I can live with that. For one reason or another I needed to do something like this recently:
select true as somefield,...
The alternative ...
I have a C# wraper class with a series of methods accepting various data types:
public class MyClass
{
public void ProcessString(string Value) { // implementation }
public void ProcessInt(int? Value) { // implementation }\
public void ProcessOther(MyClass Value) { // implementation }
}
I now want to add a generic ProcessOb...
I have a char* name which is a string representation of the short I want, such as "15" and need to output this as unsigned short unitId to a binary file. This cast must also be cross-platform compatible.
Is this the correct cast: unitId = unsigned short(temp);
Please note that I am at an beginner level in understanding binary.
...
I am using code similar to this to populate a combobox with items from a database. The display works fine, but when I try to get the combobox.SelectedValue it is returning a DataRowView, where I need an integer. Obviously this is becuase I haven't casted the value to an integer, but the function, CInt(cboPosition.SelectedValue) is thro...
I'm trying to pull the two components out of a timeval struct and place them into strings.
I'm not having much luck with this. I've attempted casting and converting first to a long and then to a string. I need the most efficient way to do this.
Any ideas? I do NOT want to convert to another data structure first (localtime, etc). I need...
I need to convert time from one format to another in C++ and it must be cross-platform compatible. I have created a structure as my time container. The structure fields must also be unsigned int as specified by legacy code.
struct time{
unsigned int timeInteger;
unsigned int timeFraction;
} time1, time2;
Mathematically the conv...
Hello. How can I cast to integer in PHP using only 1 or two chars?
If I have the operation $a = (int) $b; it will result using those two (or one) chars: $a = <insert the needed 1 or 2 chars> $b;
I need only to cast to integer. Thank you.
...
Instead of trying to trying to put my problem into words, here's some code that demonstrates what I want to do:
Class [] domains = { Integer.class, Double.class, String.class };
String [] stringValues = { "12", "31.4", "dog" };
Comparable [] comparableObjects = { null, null, null };
for (int i = 0; i < domains.length; i++) {
// Tri...
I'm trying to change the application schema of a database in Postgres...so I need to copy data from one table to another. In the original table, co-ordinates are specified as numeric values in two separate columns, one for the x value and one for the y value. In the new table, the co-ordinates need to be stored as one value of the point ...
I have a class and two other classes extending it. I essentially want to be able to make an object of the main class and then be able to convert/cast it into the appropriate subclass depending on some conditions of the object itself. Alternatively, I could replace the instance of the main class with an instance of the subclass. Are eithe...
Hi,
I am wondering if it is possible to do something. I have a function that reads an xml file and adds controls to a form based on the contents on the file. An xml node like this will create it:
<Button Top="300" Left="100">Automatic</Button>
I have a function that saves the controls back to the xml file if I have added any in an ...
Okay, so this might be a bit of an academic question. Can someone tell me if/how C++'s casting operators might translate to Objective-C... or how/why they're not necessary?
I've been out of the loop with C++ for a few years now and it seems like every time I turn around they add a few new keywords. I was recently introduced to C++'s v...
A simple question...
I have an abstract class Cell and two classes BorderCell and BoardCell, which inherit from the Cell class. Then I have a Cells array with the type of Cell[], which contains objects of the type BorderCell and BoardCell.
abstract class Cell
{
}
class BorderCell : Cell
{
public void Method1(){};
}
class BoardCel...
I have a method that either adds or updates a record in a DB (SQL Server), and it returns the RecordID as an (Int32) Output Parameter, and a success/failure result as (Int32) Return Value.
Given that I'm specifying the type of these parameters, why do I have to cast them when they are returned?
I expected to used the following:
enquir...
Hi, I'm trying to upgrade from PHP 5.2.x to 5.3.2 on my server. Problem is, I relying on the broken implementation of PHP's ezmlm_hash() (the bug is outlined here: http://bugs.php.net/bug.php?id=47969).
My first thought was to rewrite the broken version of the native PHP function (which is written in C) myself in PHP and use that in my ...
I have several classes that implement the same interface.
interface IBidManager<E> where E : IEntity
public class BidManager : IBidManager<EntityObject1>
public class BidManager2 : IBidManager<EntityObject2>
public class BidManager3 : IBidManager<EntityObject3>
In my business manager class I have:
public class BusinessManager : Mana...