Monday, December 10, 2012

advantages of template in c++

Templates are a good candidate for coping with combinatorial behaviour's because they generate code at compile time based on the types provided by the user.

Class templates are customizable in ways not supported by regular classes. If you want to implement a special case, you can specialize any member functions of a class template for a specific instantiation of the class template. For example, if the template is SmartPtr<T>, you can specialize any member function for, say, SmartPtr<Widget>. This gives you good granularity in customizing behaviour.

Furthermore, for class templates with multiple parameters, you can use partial template specialization. Partial template specialization gives you the ability to specialize a class template for only some of its arguments. For example, given the definition

template< class T, class U> class SmartPtr { ... };

you can specialize SmartPtr<T, U> for Widget and any other type using the following syntax:

template< class U> class SmartPtr<Widget, U> { ... };

The innate compile-time and combinatorial nature of templates makes them very attractive for creating design pieces. As soon as you try to implement such designs, you stumble upon several problems that are not self-evident:

1.      You cannot specialize structure. Using templates alone, you cannot specialize the structure of a  class (its data members). You can specialize only functions.

2.      Specialization of member functions does not scale. You can specialize any member function of a class template with one template parameter, but you cannot specialize individual member functions for templates with multiple template parameters. For example:

template <class T> class Widget
{
     void Fun() { .. generic implementation ... }
};

// OK: specialization of a member function of Widget
template <> Widget<char>::Fun()
{
... specialized implementation ...
}
template <class T, class U> class Gadget
{
void Fun() { .. generic implementation ... }
};
// Error! Cannot partially specialize a member class of Gadget
template <class U> void Gadget<char, U>::Fun()
{
... specialized implementation ...
}

3.      The library writer cannot provide multiple default values. At best, a class template implementer can provide a single default implementation for each member function. You cannot provide several defaults for a template member function.

Now compare the list of drawbacks of multiple inheritance with the list of drawbacks of templates. Interestingly, multiple inheritance and templates foster complementary trade-offs. Multiple inheritance has scarce mechanics; templates have rich mechanics. Multiple inheritance loses type information, which abounds in templates. Specialization of templates does not scale, but multiple inheritance scales quite nicely. You can provide only one default for a template member function, but you can write an unbounded number of base classes.

This analysis suggests that a combination of templates and multiple inheritance could engender a very flexible device, appropriate for creating libraries of design elements.

benefits of templates c++

Templates are a good candidate for coping with combinatorial behaviour's because they generate code at compile time based on the types provided by the user.

Class templates are customizable in ways not supported by regular classes. If you want to implement a special case, you can specialize any member functions of a class template for a specific instantiation of the class template. For example, if the template is SmartPtr<T>, you can specialize any member function for, say, SmartPtr<Widget>. This gives you good granularity in customizing behaviour.

Furthermore, for class templates with multiple parameters, you can use partial template specialization. Partial template specialization gives you the ability to specialize a class template for only some of its arguments. For example, given the definition

template <class T, class U> class SmartPtr { ... };

you can specialize SmartPtr<T, U> for Widget and any other type using the following syntax:

template <class U> class SmartPtr<Widget, U> { ... };

The innate compile-time and combinatorial nature of templates makes them very attractive for creating design pieces. As soon as you try to implement such designs, you stumble upon several problems that are not self-evident:

1.      You cannot specialize structure. Using templates alone, you cannot specialize the structure of a  class (its data members). You can specialize only functions.

2.      Specialization of member functions does not scale. You can specialize any member function of a class template with one template parameter, but you cannot specialize individual member functions for templates with multiple template parameters. For example:

template <class T> class Widget
{
     void Fun() { .. generic implementation ... }
};

// OK: specialization of a member function of Widget
template <> Widget<char>::Fun()
{
... specialized implementation ...
}
template <class T, class U> class Gadget
{
void Fun() { .. generic implementation ... }
};
// Error! Cannot partially specialize a member class of Gadget
template <class U> void Gadget<char, U>::Fun()
{
... specialized implementation ...
}

3.      The library writer cannot provide multiple default values. At best, a class template implementer can provide a single default implementation for each member function. You cannot provide several defaults for a template member function.

Now compare the list of drawbacks of multiple inheritance with the list of drawbacks of templates. Interestingly, multiple inheritance and templates foster complementary trade-offs. Multiple inheritance has scarce mechanics; templates have rich mechanics. Multiple inheritance loses type information, which abounds in templates. Specialization of templates does not scale, but multiple inheritance scales quite nicely. You can provide only one default for a template member function, but you can write an unbounded number of base classes.

This analysis suggests that a combination of templates and multiple inheritance could engender a very flexible device, appropriate for creating libraries of design elements.

Sunday, November 18, 2012

marketing specialist officer jobs


We have an excellent opening as a consultant to work with the below job requirement,

Job Description:
For our enterprise products under development we are looking for person who has a good past work experience in evaluating the enterprise products based on market requirement and providing valueable enhancements and change comments. When the product is ready to ship you will be considered as a main point of contact for product marketing specialist.

Below is the required mandatory skills:
  1. Should already have a work experience with at least 3 - 5 products evaluation.
  2. At least 5 years of work experience in IT.
  3. Must be enrolled to some organization.
You may send your resume to "support@ccplusplus.com".

element access list c++


Because a list does not have random access, it provides only front() and back() for accessing elements directly

Table. Direct Element Access of Lists

Operation
Effect
c.front()
Returns the first element (no check whether a first element exists)
c.back()
Returns the last element (no check whether a last element exists)

As usual, these operations do not check whether the container is empty. If the container is empty, calling them results in undefined behavior. Thus, the caller must ensure that the container contains at least one element.

For example:

std::list<Elem> coll; // empty!
std::cout << coll.front(); // RUNTIME ERROR ? undefined behavior
if (!coll.empty()) 
{
   std::cout << coll.back(); // OK
}

See Also:

Saturday, September 22, 2012

marketing specialist officer jobs

We have an excellent opening as a consultant to work with the below job requirement,

Job Description:
For our enterprise products under development we are looking for person who has a good past work experience in evaluating the enterprise products based on market requirement and providing valueable enhancements and change comments. When the product is ready to ship you will be considered as a main point of contact for product marketing specialist.

Below is the required mandatory skills:
  1. Should already have a work experience with at least 3 - 5 products evaluation.
  2. At least 5 years of work experience in IT.
  3. Must be enrolled to some organization.
You may send your resume to "support@ccplusplus.com".

Thursday, September 6, 2012

being human anad love human

We want to covey a good news to our visitors that we have initiated a noble work by establishing a trust

This is established with the aim and hope of serving humanity, love, culture and being human relationship.

Currently we are only funding the trust with the part of the annual income of "ccplusplus".

If you feel you also want to join as a helping hand to create a beautiful, please write to us.

Our honest and trust will be always with you. This we can promise.

Regards,
Saurabh Gupta
Founder & CEO
ccplusplus.com

Sunday, August 5, 2012

list assignment operator c++


Lists also provide the usual assignment operations for sequence containers, see table below,


As usual, the insert operations match the constructors to provide different sources for initialization.

See Also:

assignment operations in list c++


Lists also provide the usual assignment operations for sequence containers, see table below,


As usual, the insert operations match the constructors to provide different sources for initialization.

See Also:

Sunday, July 29, 2012

checking glibc version linux


Glibc package comes with a bundle of suits and all of them have the same version which glibc library has. ldd  is one of the package that comes with glibc. Hence by checking the version of the ldd we can find the glibc version. Below is the command that is executed on linux rhel 6 64 bit environment and rhel 5.5 32 bit environment.

rhel6 64 bit


rhel 5.5 32 bit


how to check glibc version in linux

Glibc package comes with a bundle of suits and all of them have the same version which glibc library has. ldd  is one of the package that comes with glibc. Hence by checking the version of the ldd we can find the glibc version. Below is the command that is executed on linux rhel 6 64 bit environment and rhel 5.5 32 bit environment.

rhel6 64 bit


rhel 5.5 32 bit


Tuesday, July 17, 2012

freelance job opening

Job Opening in ccplusplus.com

We are looking for professional developer to work for us with the below requirement,

#################################################################################
-----------------------
Technical Requirements:
-----------------------
  • Must have C/C++ expertise with a minimum of 4 yeas experience.
  • *NIX/Windows Development experience.
  • Open Source tools Development Experience under Linux and windows.
  • Knowledge of shell script and Python is preferred
  • Batch File knowledge is good to have.
  • Knowledge of Socket and Multi-Threaded programming.
  • Should have worked on Windows server machines Ubuntu/Linux flavors.
-----------
Job Nature:
-----------
  • This is not a permanent requirement with us. 
  • Must be open to work on 7 days a week depends upon work. 
  • Should be flexible to work according to GMT.
  • Time commitment and delivery is the major factor of our success and you should have that.
  • You will be working on projects with time duration of 1 months to 6 months and may be more based on requirements.
  • You will be working on Research projects and in house development projects.
#################################################################################

For more details please write us : support@ccplusplus.com


Friday, July 13, 2012

c++ projects in network security


We have strong team of corporate developers who have years of experience in development using the C/C++ languages under Linux and Windows platform.

We have started new developments of the projects of Network Security based projects. They are all new projects that you will not find at any other source.

To develop a project of your requirement contact us, we will promise to get it developed for you with the least time and amount that you have planned.

We have a huge list of clients and students across the globe in various reputed universities. In India we also have a huge number of engineering students who are studying in various NIT's and REC's including AIEEE and UPTU engineering colleges.

This is commitment from our side if you are not satisfied with our work done we will be refunding you project cost and will rework without any charge.

We are also providing a live demo and support for the project work. Please go through the below contact details.

projects in cryptography and network security


We have strong team of corporate developers who have years of experience in development using the C/C++ languages under Linux and Windows platform.

We have started new developments of the projects of Network Security based projects. They are all new projects that you will not find at any other source.

To develop a project of your requirement contact us, we will promise to get it developed for you with the least time and amount that you have planned.

We have a huge list of clients and students across the globe in various reputed universities. In India we also have a huge number of engineering students who are studying in various NIT's and REC's including AIEEE and UPTU engineering colleges.

This is commitment from our side if you are not satisfied with our work done we will be refunding you project cost and will rework without any charge.

We are also providing a live demo and support for the project work. Please go through the below contact details.