Is there any way to get the size of any data type or ADT without using sizeof

Hi ,

Is there any way of getting the size of any ADT or simple data type
like int etc without using sizeof

And how does the sizeof() function work

Posted On: Monday 5th of November 2012 01:49:35 AM Total Views:  271
View Complete with Replies

Related Messages:

Is there anything wrong with std::pow?   (328 Views)
The output of the following program is (-27.7128,16) (-9.09495e-12,32768) Obviously, y*y*y is not equal to x, even the magnitude is off. I'm wondering what is wrong here.
Is there a ORM Library for c++?   (420 Views)
Is there a ORM(O/R Mapping) library for c++ Like toplink, hibernate in java. I can't find one in the internet. Is there any difficulty to implement it in c++ Or it's performance is poor
Is there any such option?   (291 Views)
In my car I have a 6 CD changer which doesn't plays other than purchased. Do I have any option to burn songs of my choice and convert it to the format supported by CD player in my car Waiting eagerly for the response!
Are there any very large open source C++ projects?   (519 Views)
{ note that your answer may not be specific to C++, in which case please propose follow-ups to a more appropriate newsgroup. thanks. -mod } Hi all, [see subject line.] By "very large", I mean something composed of a hundred million lines of code or more (i.e., projects that make KDE look pretty small by comparison.) If there are none with >=100MLoC, then what are some of the largest open source C++ projects I'm interested in learning (through several examples) about how very large C++ projects are managed in practice. - James -- [ See for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] , On Sep 1, 12:49 am, james.wid... wrote: > { note that your answer may not be specific to C++, in which case > please propose follow-ups to a more appropriate newsgroup. thanks. > -mod } > > Hi all, > > [see subject line.] Boost is probably the biggest project in modern C++. They're probably not as large as other projects, but since Boost is actually cut in a lot of other subprojects it might be interesting to see how they are organized. -- [ See for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
Is there any STL function for sorting characters inside a string?   (364 Views)
I'm looking for a STL function to sort characters inside a string, like: string_sort("disprove") => "deioprsv".
is there any portable way of __PRETTY_FUNCTION   (347 Views)
g++ has a predefined macro __PRETTY_FUNCTION. I think it is a gcc extension. Is there anything equivalent that is defined in the standard or any library ( e.g. BOOST, ACE )
Is there a class name macro?   (295 Views)
__PRETTY_FUNCTION__ is a macro that gives function name, etc. I'm wondering if there is a macro to get the class name inside a member function.
Is there any good library providing threadpool?   (307 Views)
Hi all, I'm looking for a library that provides a threadpool. I know "threadpool" from boost. Is there any other library Cheers, Alex
why there is an error when using stringstream?   (286 Views)
The following code would output "error". I don't understand why there is such error. Could you please help me
include paths - is there a defacto standard?   (481 Views)
The standard doesn't define this but what conventions do projects use As I understand it, #include is used for including system headers and those of frameworks such as wxWidgets - and #include "someheader.h" is used for more application-specific things. The VC8 docs say, #include searches the paths set for the project, but #include "..." tries the dir of the file with the include, and the file that included it etc... before it searches the project setting include paths. Is this a defacto standard, or do compilers implement different ways of doing it Is there a sort of minimal conventions programmers stick to to be compiler-independent
Is there 'private' in namespace?   (235 Views)
I'm wondering if there is something in namespace like the 'private' keyword in class I want to define some class or function that can only be used within that namespace.
isthere any tools that could help me check include dependency between c++ files?   (393 Views)
sometimes project compile error just because incorrect include relation between files. and it's a headache to check manually, i want to know is there any tools could help me to do that
Are there statistics packages in ANSI C and/or ANSI C++?   (242 Views)
Like this one Basically I need the mean, standard deviation and skewness and preferably a legal hassles free one
Is there any way to provide a custom destructor/destroy function with   (339 Views)
I'm pretty sure the answer is no, but thought I'd check. I'm trying to protect a pointer to a C-based struct that needs to be deallocated through an API call. I was thinking of simply creating a wrapper class for the struct that calls the API function in its destructor, but I'm hoping there is a cleaner way of doing this.
Is there typedef template?   (255 Views)
I'm wondering if it is possible to define typedef template For example, I have template class A. I want give it an alias such as B. The problem comes from refactoring the code. Suppost A is not a template class. After refactoring, I decide to add a template parameter to it. But the original following code need to be updated as well. typedef A B; However, I don't find any easy way to change such code.
Is there a way to find out which object called another?   (240 Views)
Hi! I just ran into a problem, I need to find out which object called another object so the proper code can be run. I'm implementing a rudimentary scheduler for software tasks. 1. I got a couple of run queues (which a pretty much vectors) 2. I got tasks which are bound to those run queues (each task only to 1 queue) 3. the scheduler is called every time a task stalls, and then needs to do rescheduling (changing the order in the run queue, adding or removing tasks) My problem now is that the scheduler is only supposed to modifiy the run queue in which the task is present which called the scheduler. Is that possible I know which tasks are in which run queue so I would just need some sort of handle to the calling task to look it up.
Is there any tool to demangle the names   (245 Views)
MhpiStrToValue-g.o:00000000000001c8 T _ZN14mhpiValueClassC1ER10vhpiValueC MhpiStrToValue-g.o:0000000000000098 T _ZN14mhpiValueClassC1ER9vpiValueC MhpiStrToValue-g.o:0000000000000130 T _ZN14mhpiValueClassC2ER10vhpiValueC MhpiStrToValue-g.o:0000000000000000 T _ZN14mhpiValueClassC2ER9vpiValueC I am seeing multiple defintions in the object file. Now the names have been mangled, can I see the demangled names from above -Parag
error C2679: binary '   (374 Views)
I have written this code, and at the end, I am trying to write a vector of strings into a text file. However, my program is nor compiling, and it gives me the following error when I try to write to the file: error C2679: binary '
Is there any way that i can find wether float variable contains fraction??   (282 Views)
Hi Is there any way that i can find wether float variable contains fraction for eg:- if( isWholeNumber(b)) { //do here } isWholeNumber(float var) should return true for the float numbers like 10.000 ,11.000 etc and it shuold be false for numbers like 10.112 (if it contains fraction), 11.092123
Any dot-operator proposals out there?   (205 Views)
I've occasionally wanted to be able to override the dot-operator, and a wish for that operator occasionally pops up in comp.lang.c++ and comp.lang.c++.moderated. My search for a proposal to add support for this operator has been without success, however, and I wonder why. Are there anyone here who know about any proposals supporting operator. If not, do you know about anything that would prevent an easy implementation of said operator /Peter --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use ] [ --- Please see the FAQ before posting. --- ] [ FAQ: ] , > This particular use case is not convincing because the access to the static > count should probably happen through a static function. Agreed, the example was no good because the wrapper only added a static interface. I do belive there are other valid examples. I'll have another try; Say you make a "copy on write" wrapper class. The wrapper behaves like the wrapped object, the only difference is that the actual wrapped object (that you moved/copied onto the heap) can be shared by many wrappers. When a wrapper object is copy constructed the destination will only get a shallow copy, a full deep copy is delayed until needed. A deep copy will be needed when the wrapped object is written to or when its address is taken. The wrapper interface could then be extended to allow the user to force a deep copy (on a per object basis, as in not on a static class basis). Why would that be useful Say the client enters some part of his system that has multiple threads using these objects. The user wants to make sure that the two wrappers dont share any internal data before entering so that he wont have to do any syncing between the two objects. Or say that at certain times the clients system has to be fast, and at other times the system waits around doing nothing. The user could then use this idle time to do deep copying so that the system wont be forced to do that the next time the system is under time preassure. I hope this example makes better sense than the previous one.