recursive dereferencing template revisited

This is a discussion on recursive dereferencing template revisited within the C++ Programming forums, part of the General Programming Boards category; ok, so my last posting on the subject wasn't exactly correct (big suprise). what I'd really like to know is ...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,700

    Post recursive dereferencing template revisited

    ok, so my last posting on the subject wasn't exactly correct (big suprise). what I'd really like to know is if the solution is complete. I figured that if anyone could break my code it'd be you guys. =)

    the purpose of the library is of course to provide a compile-time dereferencing mechanism for pointers and specialized types. for example:

    Code:
    #include <iostream>
    #include "content.h"
    
    using namespace std;
    using namespace xtd;
    
    int
    main( void )
    {
    	int
    	   i = 1024,
    	   * p = &i,
    	   ** pp = &p,
    	   *** ppp = &pp;
    	extract( ppp )++;
    	cout << extract( ppp ) << endl;
    	return 0;
    }
    below I've attached the header file and some minor examples. any comments or suggestions are welcome.
    Attached Files Attached Files
    Last edited by Sebastiani; 02-16-2008 at 11:11 AM. Reason: clarity
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,700
    I've made some minor changes: the header file was renamed to 'extract.h' (the actual file extension was .hpp but the board doesn't allow attachments with that extension). I also removed the ugly specialization macro and added comments for clarity.

    I've done a lot of testing but then again there's always the chance that I may have overlooked something. please let me know if you have any problems compiling the code...
    Attached Files Attached Files
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specialising a member function with a template template parameter
    By the4thamigo_uk in forum C++ Programming
    Replies: 10
    Last Post: 10-12-2007, 04:37 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 11:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21